July 15th, 2000, 12:39 AM
This may be a little off the PHP topic but I've seen similar questions so I'll post it anyway.
I want to make a file archive where when a file link is clicked, it prompts the browser to open the Save As dialog. I've tried doing this by sending the header "Content-type: application/octet-stream" and then sending the file with readfile(). This works fine, however the browser puts my PHP file's name as the default name. I want the linked file's name to be the default.
July 15th, 2000, 10:48 AM
I'm not real sure about this, but it's probably worth a try.. when you pass a file
via a form element using the enctype="multipart/form-data" you can
get the name and size and type from a set
of variables.. if you file field was named
upload then to get the
uploaded files information you would use something like:
$upload_name <-gives the files name
$upload_type <-gives you the mime/type
$upload_size <-gives you the file size
So, you might try using something like that.. again, don't know if it would work, but if you can pass the mime/type through a get statement, then sure you can pass the files name by adding an _name=blah ...
Low Cost Hosting and Web Development.
July 30th, 2000, 11:17 AM
Should send the file as thefilename.exe !
August 2nd, 2000, 12:20 AM
Thanks for your help damari but this only works under Netscape. It still has no effect on IE4 (not sure about IE5)!
August 2nd, 2000, 04:51 AM
I tested it with both IE5 & IE5SP1 with success! But it won't work in IE5/IE5SP1 if you use HTTPS.