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
$options = array( 'auto_create_dir' => FALSE, 'file_max_size' => '5000000', 'mime_check' => TRUE, 'allowed' => array('image/jpeg','image/gif','image/png'), 'no_script' => true, #güvenlik 'image_resize' => true, 'image_ratio_crop' => true, 'file_auto_rename' => true, 'file_name_body_pre' => 'tt_' ); $handle = new Upload($_FILES['resim']); if ($handle->uploaded) { // assign the array values to the class properties foreach ($options as $key => $value) { $handle->$key = $value; } }