Access a file within a folder with spaces in the name in PHP
<p>I would like to open a file inside a folder in PHP. The problem is that the folder that contains the file may have spaces in the name. The code I use to open the file (and doesn't work) is the following:</p>

<pre><code>$myFile = "path/to the/file.txt";
$myFile = str_replace(' ', '\ ', $myFile);
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo $theData;
</code></pre>

<p>As you can see, I'm trying to solve the problem by putting a <code>\</code> in front of the space, but this doesn't solve the issue. I still receive the following error:</p>

<pre><code>Warning: fopen(path/to\ the/file.txt) [function.fopen]: failed to open stream: No such file or directory in /path/to/my/website on line 49
</code></pre>

<p>Any idea on how to solve this issue?</p>

<p>Thanks!</p>
