sarah_anne
07-14-2005, 10:15 AM
Hi guys,
I wasn't sure whether to post this in Perl, Misc SS, or General web building as it's a bit of a crossover, but figured that since it's a Perl-driven app I'm playing with I may as well put it here ;)
I have a cgi script that simply outputs a directory/file listing of a root folder -- note that the Perl script is running on an intranet (*nix Y: drive) but the output listing is from something like K:/projects/stuff which has various subdirectories too.
I'd like users to be able to download the files they see, so have placed a link to be displayed next to the filename saying "Download", which looks like "file://csldc01/projects/stuff/Internal%20Bulletins/Misc/Bhist%20operation.doc" (notice I've had to use the drive name here).
PROBLEM:
When viewed in IE and you click on this link, it automatically opens Word/pdf viewer/etc and displays the file. That's great.
When viewed in IE and you right click on this link, there is the option to Save Target As, which preserves everything well. That's cool too.
However, in firefox if it sees a link like "file://csldc01/projects/stuff/Internal%20Bulletins/Misc/Bhist%20operation.doc" and the user clicks on it, nothing happens at all!
To get around this, I tried implementing a force-download script using http://www.sitepoint.com/article/file-download-script-perl ...however this does not seem to work with files with spaces in their names ("Bhist%20operation.doc" gets saved as "Bhist" without all of its name or any extension!).
Any advice?
edit: I've tried convincing myself that I should just ask users NOT to use spaces in their filenames when adding files, but this is a poor solution and would work for, oh, a day :rolleyes:
I wasn't sure whether to post this in Perl, Misc SS, or General web building as it's a bit of a crossover, but figured that since it's a Perl-driven app I'm playing with I may as well put it here ;)
I have a cgi script that simply outputs a directory/file listing of a root folder -- note that the Perl script is running on an intranet (*nix Y: drive) but the output listing is from something like K:/projects/stuff which has various subdirectories too.
I'd like users to be able to download the files they see, so have placed a link to be displayed next to the filename saying "Download", which looks like "file://csldc01/projects/stuff/Internal%20Bulletins/Misc/Bhist%20operation.doc" (notice I've had to use the drive name here).
PROBLEM:
When viewed in IE and you click on this link, it automatically opens Word/pdf viewer/etc and displays the file. That's great.
When viewed in IE and you right click on this link, there is the option to Save Target As, which preserves everything well. That's cool too.
However, in firefox if it sees a link like "file://csldc01/projects/stuff/Internal%20Bulletins/Misc/Bhist%20operation.doc" and the user clicks on it, nothing happens at all!
To get around this, I tried implementing a force-download script using http://www.sitepoint.com/article/file-download-script-perl ...however this does not seem to work with files with spaces in their names ("Bhist%20operation.doc" gets saved as "Bhist" without all of its name or any extension!).
Any advice?
edit: I've tried convincing myself that I should just ask users NOT to use spaces in their filenames when adding files, but this is a poor solution and would work for, oh, a day :rolleyes: