Downloading a file cause error when it contains spaces - PHP
<p>Consider that i am uploading a file with following names:</p>

<ol>
<li>test.pdf</li>
<li>test file.pdf</li>
</ol>

<p>When i download the test.pdf it's working fine.. </p>

<p>But when i download test file.pdf it doesn't. <strong>The case is the space between the file name.</strong></p>

<p><strong>Unfortunately i should not change the file name when i upload (If i can i will set "_" using str_replace between spaces and resolve this issue).</strong></p>

<p><strong>Now how should i download the file ?</strong> </p>

<p>My code is given below:</p>

<pre><code>header('Content-disposition: attachment; filename=test file.pdf');
header('Content-type: application/pdf');
readfile('test file.pdf');
</code></pre>

<p>Thanks in advance...</p>
