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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Corrupt Image Detection

Status
Not open for further replies.

dneff

Programmer
Aug 15, 2002
8
US
I have a problem where somebody cancels the process of an image being uploaded, yet it somehow still gets to the server. The PHP code handles the uploaded file, yet the file is corrupt (or incomplete). Later, PHP code tries to do a createimagefromjpg() on the file and everything blows up with a Fatal Error.

Is there a way in PHP to detect if an image file is valid before calling this function? I don't believe there is a way to trap a Fatal Error.

Thanks,

-David
 
did u try it with an if stmt? use it to capture the error:
if(DOSOMETHING)
//Successfull
else
//Unsuccessfull

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top