Re: [PHP] popping up download dialog box
try this: ?php function download($file , $name) { $size = filesize($file); header(Content-type: application/octet-stream); header(Content-disposition: attachment; filename=.$name); header(Content-Length: .$size); header(Pragma: no-cache); header(Expires: 0); readfile($file); } download(file_on_server.dat,download_as_.dat); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] popping up download dialog box
if (!empty($file['file_data'])) { if (get_user_os() == MAC) { header(Content-Type: application/x-unknown\n); header(Content-Disposition: attachment; filename=\.$file ['file_name'].\\n); } elseif (get_browser_info() == MSIE) { $disposition = (!eregi(\.zip$, $file['file_name']) $action ! = zip $action != lightbox) ? 'attachment' : 'inline'; header(Content-Disposition: $disposition; filename=\.$file ['file_name'].\\n); header(Content-Type: application/x-ms-download\n); } elseif (get_browser_info() == OPERA) { header(Content-Disposition: attachment; filename=\.$file ['file_name'].\\n); header(Content-Type: application/octetstream\n); } else { header(Content-Disposition: attachment; filename=\.$file ['file_name'].\\n); header(Content-Type: application/octet-stream\n); } header(Content-Length: .$file['file_size'].\n\n); echo $file['file_data']; } exit; Un saludo, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] popping up download dialog box
On Friday 18 July 2003 06:34, Binay Agarwal wrote: Hi every body ! I am writing a script which pops up download dialog box on click of a Link. Headers i m sending out for downloading jpegs are: header(Cache-control: private); header(Content-Type: image/jpeg); header(Content-Type: application/octet-stream); header(Content-Length: $size); header(Content-Disposition: attachment; filename=$fname); header(Content-Transfer-Encoding: binary); readfile($fname); All these work well in MSIE 5.0+ and Netscape 4.7+ . But on Mac I.E its not popping up the dialog box rather it opens up the jpg file in the browser window. I don know where am i doing wrong. Please suggest me . I cracked my mind for hours but in vain. So please help me out. Having two Content-Type: headers is probably confusing the poor Macs. You don't want the first one anyway so remove it. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* When the speaker and he to whom he is speaks do not understand, that is metaphysics. -- Voltaire */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] popping up download dialog box
Hi jason Thanks for the quick suggestion. I tried removing the first content-type header but still the problem reamains. I don know why?? Please let me know is there other way i can do the same? Thanks Binay - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, July 18, 2003 4:00 PM Subject: Re: [PHP] popping up download dialog box On Friday 18 July 2003 06:34, Binay Agarwal wrote: Hi every body ! I am writing a script which pops up download dialog box on click of a Link. Headers i m sending out for downloading jpegs are: header(Cache-control: private); header(Content-Type: image/jpeg); header(Content-Type: application/octet-stream); header(Content-Length: $size); header(Content-Disposition: attachment; filename=$fname); header(Content-Transfer-Encoding: binary); readfile($fname); All these work well in MSIE 5.0+ and Netscape 4.7+ . But on Mac I.E its not popping up the dialog box rather it opens up the jpg file in the browser window. I don know where am i doing wrong. Please suggest me . I cracked my mind for hours but in vain. So please help me out. Having two Content-Type: headers is probably confusing the poor Macs. You don't want the first one anyway so remove it. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* When the speaker and he to whom he is speaks do not understand, that is metaphysics. -- Voltaire */ -- 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
Re: [PHP] popping up download dialog box
Binay Agarwal [EMAIL PROTECTED] wrote: Hi every body ! I am writing a script which pops up download dialog box on click of a Link. Headers i m sending out for downloading jpegs are: header(Cache-control: private); header(Content-Type: image/jpeg); header(Content-Type: application/octet-stream); header(Content-Length: $size); header(Content-Disposition: attachment; filename=$fname); header(Content-Transfer-Encoding: binary); readfile($fname); All these work well in MSIE 5.0+ and Netscape 4.7+ . But on Mac I.E its not popping up the dialog box rather it opens up the jpg file in the browser window. I don know where am i doing wrong. Please suggest me . I cracked my mind for hours but in vain. So please help me out. No matter what you do you cant guarantee that the pop-up box, it all depends on how the client's browswer software wants to do with that paticular mime-type. have you tried sending out something like just to see something unknown forces it to open: header(Content-Type: application/makeupyourown); Curt. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php