[Vfs-devel] Correct filename without mod_rewrite
Status: Alpha
Brought to you by:
eesa
|
From: Abdul-Wahid P. <ee...@we...> - 2000-06-06 22:55:29
|
When I first started developing VFS I had the problem that when the user tries
to download a file because it is a PHP script that returns the file the
browser tries to save the file as get_file.php3
To get around this problem I put in a mod_rewrite rule in the .htaccess file
as follows:
RewriteRule ^(.*?)/file/.*$ get_file.php3?file=$1 [T=application/x-httpd-php3]
This worked fine but it made VFS reliant on the user having mod_rewrite
Someone today showed me how to do it without using mod_rewrite basically all
we have to do is add this header:
header("Content-Disposition: inline\; filename=$file_name");
The browzer then changes the filename to the given filename and saves it as
that rather than as get_file.php3
I have tested it so far on Netscape 4.7, IE 5.5 and Lynx 2.8.3 and it seems to
work fine. Can anyone test it on any other browsers. Especially older ones. I
am not sure how long this feature has been implemented.
I have attached the get_file.php3 with the necessary modifications. You can
use it for testing by calling get_file.php3?file=$file_id where $file_id is
the file_id of the file you want to test.
If all works fine I think we should include this in any 0.1 updates ahead of
the 0.2 database integration release
Regards,
AW
|