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
if ($handle->processed) { // everything was fine ! echo 'file uploaded with success'; echo ''; $info = getimagesize($handle->file_dst_pathname); echo ' ' . $info['mime'] . ' '. $info[0] . ' x ' . $info[1] .' - ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB'; echo 'Image Uploaded!'; $idprogetto=$_POST["idprogetto"]; $caption=$_POST["caption"]; $buy=$_POST["buy"]; $insert="INSERT INTO `images` (id,idproject,caption,buy,link)". " VALUES (' ','$idproject','$caption','$buy',". "'".$handle->file_dst_name."')"; $risult=mysql_query($insert, $link); }