When I upload a filename with spaces in it. (i.e. Hot Blue.JPG) into a directory, the filename ($file) variable doesn't get read properly. If a file name is uploaded without any spaces in the name, (i.e. HotBlue.jpg) the $file variable reads it fine. Anyone have suggestions on reading the complete file name with spaces?
Due to the fact that file names with spaces are not being read propery, is in turn keeping me from deleting the $file (the filename)...
<?
if ($handle = opendir('content/clients/'.$_SESSION['username'].'')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file | <a href=$PHP_SELF?action=upload&image=remove&file=$file>Delete</a><br>";
}
}
closedir($handle);
}
extract($_REQUEST);
if($image == "remove"){
$thefile = $_REQUEST['file'];
unlink("content/clients/".$_SESSION['username']."/$thefile");
echo "<script type=\"text/javascript\">window.location = \"$PHP_SELF?action=upload\";</script>";
}
?>