If your filename contains "weird" characters, you should best put double quotes around the filename. And Perl has powerful string interpolation syntax features, so you don't have to concatenate all the loose parts yourself. It makes code just a little bit more tidy.$headers_hash->{'Content-disposition'} = "attachment; filename=" . $re +port_name . ".csv";
In case you wish to embed double quotes, it may be beneficial to use qq with any delimiter or delimiter pair you like, so you can drop the backslashes:$headers_hash->{'Content-disposition'} = "attachment; filename=\"$repo +rt_name\".csv";
$headers_hash->{'Content-disposition'} = qq(attachment; filename="$rep +ort_name".csv);
Also, be aware that there's no way to force a browser to dowload a file, all you can do is make a polite request. It's the browser itself, and the user behind the keyboard, that has the final word. See the late Alan J. Flavell's view on this matter, a view shared by many other experts, in the last post in this thread:
The original idea of the interworking protocols was that it was the *recipient's* business to decide whether they wanted to render a resource or to download it. The author/publisher's job was just to advertise its content-type honestly (as you note). The idea of a mischievous author proposing a download, to some sensitive file on the recipient's system, and the naive user acceding to the request, is just too attractive to a certain kind of pondlife on the 'net.Re: the subject line: generally speaking, "force" does not work, on the WWW. And it's good that it is so.
In reply to Re: Problem In generating the CSV file in the perl code using Apache
by bart
in thread Problem In generating the CSV file in the perl code using Apache
by sondagar_nilesh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |