My problem is that when clicking the download link of the mp4 or wmv file, the download box is not pop-up to be saved like other file types, but it turns to like a streaming video to watch in the browser.
I still cannot find the solution. Any advice? Thank you so much.
1. With nginx, what settings do I make to disable the streaming?
2. Do I need something to run with nginx?
XFileSharing Pro - Cannot download MP4/WMV after install NGINX!
Cannot download MP4/WMV after install NGINX!
Last edited by panda on Mar 23, 2012 7:27 pm, edited 3 times in total.
Nginx requires you to add the attachment header to all requested files.
Simple version, add this to your config.
We're putting the location under files because we want the progress bar to still work on file servers.
We then use Regex to see when a file is requested and if so it'll save it under $1. For ease of use we set $1 to $filename.
Add in your header using $filename.
There are a number of streaming files including mp3, mp4 and pdf so this will force download on them all.
Simple version, add this to your config.
Code: Select all
location /files {
if ($request_filename ~* ^.*?/([^/]*?)$)
{
set $filename $1;
add_header Content-Disposition "attachment; filename=$filename";
}
}
We then use Regex to see when a file is requested and if so it'll save it under $1. For ease of use we set $1 to $filename.
Add in your header using $filename.
There are a number of streaming files including mp3, mp4 and pdf so this will force download on them all.
I've added this code you mentioned to the configure file of nginx at the last. Why it's not working?trinsic wrote:Nginx requires you to add the attachment header to all requested files.
Simple version, add this to your config.We're putting the location under files because we want the progress bar to still work on file servers.Code: Select all
location /files { if ($request_filename ~* ^.*?/([^/]*?)$) { set $filename $1; add_header Content-Disposition "attachment; filename=$filename"; } }
We then use Regex to see when a file is requested and if so it'll save it under $1. For ease of use we set $1 to $filename.
Add in your header using $filename.
There are a number of streaming files including mp3, mp4 and pdf so this will force download on them all.
Any more suggestions?
Remove the MP4 mimetype from the mime.types file in nginx config folder.
Or change it to application/octet-stream.
My mime.types file:
Or change it to application/octet-stream.
My mime.types file:
Code: Select all
types {
text/html html;
}
trinsic,
Mind sharing where do you insert that code? nginx.conf or sites-enabled/conf.file? We seem to have an issue in Google Chrome downloading .mpg files. Download simply doesn't start when download link is clicked, however the file can be downloaded by clicking save link as.
Chrome Developer tools (network) says canceled. A friend of mine tested this with an older version of Google Chrome 12. something and the download works perfectly, but with the latest version it doesn't. Any suggestions?
Thanks!
Mind sharing where do you insert that code? nginx.conf or sites-enabled/conf.file? We seem to have an issue in Google Chrome downloading .mpg files. Download simply doesn't start when download link is clicked, however the file can be downloaded by clicking save link as.
Chrome Developer tools (network) says canceled. A friend of mine tested this with an older version of Google Chrome 12. something and the download works perfectly, but with the latest version it doesn't. Any suggestions?
Thanks!