Categotry Archives: ftp


Forcing a Web Browser to Save a File instead of Streaming it


I was having a dickens of a time, trying to force a browser make the user save the file, instead of trying to stream it. Here’s how to do it.

The original article is here.

1. in the directory where the file is located, we need to create a .htaccess file. So using the editor of your choice, create a filed name .htaccess (yes the period in front is important! It’s a hidden file.)

AddType application/octet-stream .wma

2. Now change the permissions on the file. Read and Write for the owner, and Read access for everyone else.

sudo chmod 640 .htaccess

it should like like:

-rw-rw—- 1 nwayno nwayno 38 2010-07-25 20:48 .htaccess

3. Restart the ftp server. If it’s standalone mode:

sudo service vsftpd restart

If vsftpd runs under xinetd (like I do), it will get the changes automatically since each new ftp session is a new process. (thanks Joe!)

4. Now when you try to ftp the file, such as:

(substitute your own information)

You will be prompted to save the file, instead of trying to stream it.

Thanks Loni