I am using a shell_exec() function to copy file in php(On windows IIS). The command I am using is :
shell_exec("copy ..\\images\\$image_url temp\\$filename\\media\\image1.png");
This is working fine until the image name($image_url) is not having space in the name. But if the image is having space in name this just fails.
Any idea how to escape the $image_url. Any help will be highly appreciated.
try this:
Basicly, it’s like on the command-prompt. If you’re having spaces in parameters you have to put quotes around them. Around the parameters – not around the spaces. 😉 How else should the copy command know, where one parameter ends and another begins.
Also make sure that
$image_urland$filenameare safe. If user have influence on their contents they could possibly do anything on your system. Be careful!