Has anyone got any idea to why doesn't the following work ?
$file = 'images/thumbs/1%20-%20Copy.jpg';
if(!file_exists($file)){
die('NOT THERE');
}
echo 'Yes its there.';
The problem is with the spaces. I have checked the file exists,dbl checked n triple checked im going nuts. :(
H开发者_如何学Pythonelp
file_exists
works on the file system and not via HTTP. So %20
will not be recognized as space but literally as %20
; use spaces instead:
$file = 'images/thumbs/1 - Copy.jpg';
$file = rawurldecode('images/thumbs/1%20-%20Copy.jpg');
try these two
$file = 'images/thumbs/1\ -\ Copy.jpg';
$file = 'images/thumbs/1 - Copy.jpg';
精彩评论