Hi
I'm having trouble determining if a file eixts oir not a remote server using the following method
if (file_exists('http://remoteserver/image.jpg') == true)
{
}
I can display the image file, and even access its attributes such as height, width and file type, just cannot get the file_exist statement to correctly determine if the file actually exists or not (always returns false).
Any help would be greatly appreciated.
Thanks
File_exists on a a remote server
Moderator: General Moderators
maybe just try it like this ?
Code: Select all
<?php
$check = file_exists('http://remoteserver/image.jpg');
if (isset($check))
{
// w/e
}
?>-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Geltran, isset checks whether it was set, file_exists() returns TRUE or FALSE. So your if statement would happen no matter what.
mzfp2:
mzfp2:
Code: Select all
<?php
if (file_exists("http://remoteserver/image.jpg")){
echo "File exists!";
}
else {
echo "No file..";
}
?>http://www.php.net/manual/en/ will help with that. 