The system I'm operating on is CentOS 6. Suppose I have this filepath: /var/www/examplesite.com/uploads/Dog Photos/happy dog.jpg
To support spaces, I'm running a simple $filepath = str_replace(' ', '\\ ', $filepath)
to escape the whitespace.
This results in a new filepath: /var/www/examplesite.com/uploads/Dog\ Photos/happy\ dog.jpg
However, file_exists($filepath)
returns false.
This is odd because stat /var/www/examplesite.com/uploads/Dog\ Photos/happy\ dog.jpg
returns the correct information on the file.
What am I doing wrong?