I have a script checking if a file exists:
function fileExists($url) {
$fh = fopen($url, 'r');
if (is_resource($fh)) {
fclose($fh);
return true;
}
return false;
}
Everything went right until I tried to uploaded files whose name contains white space. Call $url
the file's url, when I put it in the browser, it displays correctly the file, but is_resource($fh)
always returns false. Someone could help ?
Before $fh = fopen($url, 'r');
add this:
$parts = pathinfo($url);
$url = $parts['dirname'].'/'.rawurlencode($parts['basename']);
Btw, there is a PHP bug...