Hi,
I have a script that download any file to the user according to the
parameters.
I call the script like this:
download.php?fi le=xxx/myfile.doc&file _short=myfile.d oc
My script is working fine except with N4.7
It opens the download box, but the name is download.php instead of
myfile.doc
I found the same bug with N7 on the Net. The workaround is to call the
script with "/" :
download.php/?file=xxx/myfile.doc&file _short=myfile.d oc
It solves the problem with N7, but with N4.7, the only difference is with
the name. Now it is :
download_php.ht m
If I specify the content type related to the file, it works fine. But I
can't do that because the file type can be anything.
It can be a word, excel or pdf file etc etc
Do you have any idea or a script to automatically set the content-type
according to the file extension ?
here is my script:
Header("Content-Type: application/octet-stream");
Header("Content-Length: ".filesize($_GE T['file']));
Header("Content-Disposition: attachment; filename=".$_GE T['file_short']);
readfile($_GET['file']);
Many thanks nad sorry for this bad english
Rod
I have a script that download any file to the user according to the
parameters.
I call the script like this:
download.php?fi le=xxx/myfile.doc&file _short=myfile.d oc
My script is working fine except with N4.7
It opens the download box, but the name is download.php instead of
myfile.doc
I found the same bug with N7 on the Net. The workaround is to call the
script with "/" :
download.php/?file=xxx/myfile.doc&file _short=myfile.d oc
It solves the problem with N7, but with N4.7, the only difference is with
the name. Now it is :
download_php.ht m
If I specify the content type related to the file, it works fine. But I
can't do that because the file type can be anything.
It can be a word, excel or pdf file etc etc
Do you have any idea or a script to automatically set the content-type
according to the file extension ?
here is my script:
Header("Content-Type: application/octet-stream");
Header("Content-Length: ".filesize($_GE T['file']));
Header("Content-Disposition: attachment; filename=".$_GE T['file_short']);
readfile($_GET['file']);
Many thanks nad sorry for this bad english
Rod
Comment