file_exists(), is_file() & is_dir() with spaces?

Why won’t file_exists(), is_file(), is_dir() return true if the file or directory has a space in it?

I spent a few hours trying all kinds of ways to make this work. I finally settled on using $file->setName(“safe”); from PEAR’s HTTP_Upload class which makes the uploaded file “safe”.

What’s safe?

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

One thought on “file_exists(), is_file() & is_dir() with spaces?”

  1. Hey bro, just wanted to say thanks for the tip, I’m also using HTTP_Upload and had the same problem as you, so the workaround was perfect for me. For what it’s worth, your blog post has saved others the same headache you had to experience, so thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *