Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Exists - remote file

Status
Not open for further replies.

sunbase

Technical User
Jun 18, 2009
15
GB
I am importing data from an XML file including .jpg files and I am using the copy command. All works well unless the remote file is missing when I get an error.

Following advice from a colleague I have tried using getimagesize() but if the image doesnt exist I am still getting an error message "failed to open stream" and the loop that I use to import from the XML just stops. Can anybody help please?

function remote_file_exists($file){
$url=getimagesize($file);
if(is_array($url)){
return 1;
}else{
return 0;
}
}


if(remote_file_exists($ffrom)<=0){
echo "The image doesn't exist";
}else{
copy($ffrom,$tto);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top