PHP: file_exists () and copy () in paths with spaces
The system I'm working on is CentOS 6. Suppose I have this file path: /var/www/examplesite.com/uploads/Dog Photos/happy dog.jpg
For whitespace support, I run a simple $filepath = str_replace(' ', '\\ ', $filepath)
one to avoid whitespace.
This will result in a new file path: /var/www/examplesite.com/uploads/Dog\ Photos/happy\ dog.jpg
However it file_exists($filepath)
returns false.
It's odd because it stat /var/www/examplesite.com/uploads/Dog\ Photos/happy\ dog.jpg
returns the correct information about the file.
What am I doing wrong?
source to share