Forum Moderators: coopster

Message Too Old, No Replies

forcing upload of files

works, but not via https

         

louponne

8:50 am on Nov 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have set up a php script that forces upload of an excel file by the user, thus:

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=data_".date("d-m-y").".xls");
header('Cache-Control: public');
header("Pragma: no-cache");
header("Expires: 0");
echo $thedata;

This works perfectly, except when I move the script to my secure connection. At that point, Firefox will download the file, but IE says it doesn't fine it.

Any ideas?

jatar_k

4:54 pm on Nov 21, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Do you actually mean download?

I have a script that forces the download of a csv file
Good PHP solutions to small problems [webmasterworld.com] msg 9

take a look at those headers, they should help

louponne

7:22 pm on Nov 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



oh, gag - yes of course I meant download, thanks jatar.

I checked my and your scripts line by line, and this is the one that did it for me:
header("Pragma: public");

Thanks! :)

On the other hand, when I tried your complete script, it rendered the file in-browser for me. I had to change

header('Content-Disposition: inline; filename="' . $output_file . '"');

to

header('Content-Disposition: attached; filename="' . $output_file . '"');