Forcing file download

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
psmshankar
Forum Commoner
Posts: 96
Joined: Tue Aug 06, 2002 4:25 am
Location: India

Forcing file download

Post 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...
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
psmshankar
Forum Commoner
Posts: 96
Joined: Tue Aug 06, 2002 4:25 am
Location: India

Post 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????
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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);
Post Reply