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.
The folowing wont do anything else than upload the image.. (log below)
$handle = new Upload($_FILES['my_field'],'se_SE');
if ($handle->uploaded) {
// needed to set this to prevent the
// script from autorenaming images...
$handle->no_script = false;
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 400;
$handle->Process("test");
process file to test/ - file size OK - file mime OK : text/plain - file name safe format - destination variables file_dst_path : test/ file_dst_name_body : asd file_dst_name_ext : jpg - no image operation, keep extension - checking for auto_rename auto_rename to asd_2.jpg - destination file details file_dst_name : asd_2.jpg file_dst_pathname : test/asd_2.jpg - asd_2.jpg doesn't exist already - no image processing wanted - process OKReply
process file to test/
- file size OK
- file mime OK : text/plain
- file name safe format
- destination variables
file_dst_path : test/
file_dst_name_body : asd
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
auto_rename to asd_2.jpg
- destination file details
file_dst_name : asd_2.jpg
file_dst_pathname : test/asd_2.jpg
- asd_2.jpg doesn't exist already
- no image processing wanted
- process OK