Is it possible to get a url/downloaded file name change the "%20" to spaces? Like instead of downloading the file my%20file.pdf, download my file.pdf? I'd like to use PHP if possible...
Asked
Active
Viewed 3,877 times
2 Answers
7
You will need to make use of the Content-disposition
header.
Here's a relevant answer. Here's what the header might look like:
Content-disposition: attachment; filename=my file.pdf
You could also use the reference for the header() function.

Community
- 1
- 1

Jeff Meatball Yang
- 37,839
- 27
- 91
- 125
-
Jinx indeed... you could have got the green tick just as easily so +1 to you :) – Richard JP Le Guen May 23 '10 at 12:53
5
I think you can use the Content-Disposition
header to force a "Save As" dialog and recommend a file name like so:
header('Content-Disposition: attachment; filename="my file.pdf"');
The PHP.net page on header()
seems to suggest the same.

Richard JP Le Guen
- 28,364
- 7
- 89
- 119