RE: Re: [PHP-DB] folder creation in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yeah, I mentioned some of those problems in my email.  What I didn't
consider was that the content disposition headers could get around the
browser's configured behavior.

I found this page:
http://forums.devshed.com/t7307/s.html

Which recommends using:
header("Content-Type: application/octet-streamn"); 

I guess if you give it a MIME type that the browser is almost always
going to try to download instead of telling it (as the person initially
did in this example):

header("Content-Type: application/PDFfile"); 

Where the browser might want to try to get "clever" and do something
other than download it.

Good things to keep in mind though.


Sounds like all he wants to do really is to open a file dialog, not
necessarily even download a file (??)  In which case, the <input
type="file"> would actually work.

I don't know.. Again, head foggy today.  Good stuff to think about
though.

-TG

> -----Original Message-----
> From: Ben Ramsey [mailto:lists@xxxxxxxxxxxxx] 
> Sent: Tuesday, October 12, 2004 3:10 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  Re: [PHP-DB] folder creation in php
> 
> 
> Trevor Gryffyn wrote:
> > It's worth noting that if you're just generating HTML that 
> creates just
> > a regular old HREF pointing to a regular old file, that the 
> web server
> > will handle sending out the proper headers.
> 
> This isn't always the case. If the file is a CSV file and you 
> don't pass 
> the proper headers (and the proper MIME types are not 
> configured in your 
> Web server), then it may try to display the file as plain text in the 
> browser. I could list other examples.
> 
> Also, depending on your browser (*ahem* IE), the browser will try to 
> open many file types in the browser without prompting for download.
> 
> Plus, if you use a PHP script to generate content and you 
> want a user to 
> download it, often times, they will end up downloading a file of the 
> name "generate-content.php" for every single download.
> 
> With the Content-Disposition header, you can avoid these 
> situations and 
> force the browser to prompt the user to download the file with the 
> correct filename you specify.
> 
> -- 
> Regards,
> Ben Ramsey
> http://benramsey.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux