Reputation: 916
i am using following code, but its not work for me.
$img1=$info['available_now']; //http://www.jjbsports.com/pws/client/images/catalogue/products/65014201/zoom/65014201_white.jpg
$filename = $img1;
if (file_exists($filename)) {
echo "The file $filename exists";
echo '<img src="'; echo $id1; echo '"width="50" height="50"/>'."<br>";
} else {
echo "The file $filename does not exist";
echo '<img src="'; echo $id1; echo '"width="50" height="50"/>'."<br>";
}
Please help me Regards,
Found the code
$headers = get_headers($filename, 1);
echo $filename."=".$headers['Content-Length']."<br>"; // size in bytes
Upvotes: 0
Views: 97
Reputation: 59699
The PHP HTTP wrapper doesn't support stat()
, so functions like file_exists()
will never work when fed an HTTP URL.
If the file is located on your local server, use a file path that is relative to your file system. Otherwise you cannot use file_exists()
.
Upvotes: 4