Page 1 of 1
Forcing file download
Posted: Mon Nov 18, 2002 1:38 am
by psmshankar
Hi,
I want to force the browser to pop up the file download dialog box even the file is of known MIME type???
I have been trying out for some time ..but cud not get it...
Posted: Mon Nov 18, 2002 2:34 am
by twigletmac
Put the file into a zip file. Off the top of my head I can't think of another way of circumventing known MIME types.
Although this search:
http://www.google.co.uk/search?sourceid ... +MIME+type
did yield this:
http://support.microsoft.com/default.as ... us;q260519
Mac
Posted: Mon Nov 18, 2002 7:10 pm
by psmshankar
yeah...zipping the file is the default one...but i dont want to zip ..
thats the probs...
hmmm i hav already chked out that microsoft page long back...
it did not worked for me although i got the latest IE...
did you able to get that????
Posted: Tue Nov 19, 2002 6:18 am
by twigletmac
I've never tried (or needed) to do this - if changing the headers doesn't help then you really have to think about solutions like putting things in zip folders even if you don't really want to do that.
Mac
Posted: Tue Nov 19, 2002 6:30 am
by volka
while mozilla slavishly obeys to the given mime-type and appends the
appropriate filenamesuffix wether wanted or not (grrr) microsoft implemented (once in their history of development) some kind of auto-file-type-detection inspecting the stream data and assiduously ignoring the content-type setting (GRRR) - not always but far too often. It seems also that IE is a bit nitpicking when it comes to the order of the headers.
Code: Select all
header('Content-type: application/octet-stream');
header('Content-disposition: attachment; filename='.$filename);
readfile($path.'/'.$filename);