Jump to content

Archived

This topic is now archived and is closed to further replies.

snipersteve

Make File ask to be saved as when downloading

Recommended Posts

Hey all. I have a question for you that may or may not be related to PHP.

I have an area on my site where users can download different files. (mainly videos I have created)

Currently I am just pulling the filename from my database, and throwing it into a hyperlink. Of course, when you click on the link the file will start streaming as its a standard video file that Windows Media Player recognizes.

What I want to do is have the window appear where it askes you would you like to save or open the file. The user could then select which they want to do. 


The reasoning behind this is that some of my longer videos are 70+MB and take a while to initilize the stream. I don't want people to think its not working, and would rather give them the option right away to save or open the file.

Thanks!

Share this post


Link to post
Share on other sites
I remember reading somewhere that the mime type application/octet-stream would [u]make[/u] the browser download a file.

Thus, 2 opptions i can see:
Send the file in a PHP script
(something to the effect of:)
header('Content-type: application/octet-stream');
echo @file_get_contents();

or, use a .htaccess file to set your videos to serve as a specific mime type. As i recall, its:
AddType application/octet-stream .wmw

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.