class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
But now an image like jpg (interal jpeg) or a video like flv is NOT recognized!
Had to add those mime types to that allowed array and now it works.
image/* (in array allowed) is a good idea, but works not really.