Hi All,

I am using the following in my config file to force all browsers to bring up the save-as window for PDF's (rather than opening within the browser).

However, I would also like to remove "_" characters from the filename and replace with spaces to pretty up the filenames a bit.

Here is what I have so far....but I cannot figure out a way to perform a regex (or similar) on the %{FILENAME}e environment variable!

Can anyone help?

<FilesMatch "\.(?i:pdf)$">
ForceType application/octet-stream
SetEnvIf Request_URI "^.*/([^/]*)$" FILENAME=$1
Header set "Content-Disposition" "attachment; filename=%{FILENAME}e"
UnsetEnv FILENAME
</FilesMatch>

The above example works perfectly and does force the download of the file with the original filename. However, if I had a filename called "Some_File.pdf", then I would like it to download as "Some File.pdf" (without the underscore).


Thanks,
Jabba