Code: Select all
<?
else{ # only bother to process any uploaded files and set the account to being usable if the confcode is right
$images=array('main'=>'Main picture', 't1'=>'1st Thumbnail', 't2'=>'2nd Thumbnail', 't3'=>'3rd Thumbnail', 't4'=>'4th Thumbnail', 'salute'=>'Salute');
foreach($images as $key=>$value){
if($_FILES[$key]['name']){ # if they uploaded a file
if($_FILES[$key]['error'] !== (0 || 'UPLOAD_ERR_OK')){ # if there was an error
$picerr=TRUE; $warn=TRUE; $error=$_FILES[$key]['error'];
$warns[]="Uploading your $value caused an error: $error";
}
if(153600<$_FILES[$key]['size']){ # make sure it isn't over 150 KB
$picerr=TRUE; $warn=TRUE;
$warns[]="Your $value was too large. You may not upload a file over 153600 Bytes (150 KB)";
}
if('image/jpeg'!==$_FILES[$key]['type']){ # only accept jpegs
$picerr=TRUE; $warn=TRUE;
$warns[]="Your $value was not a JPEG. JPEG encoded files traditionally end with .jpe, .jpg, and .jpeg on windows.";
}
if(!($picerr)){ # if there wasn't an issue, move to the awaiting approval bin -- humans will check it's ok
$un=$_COOKIE['un']; $to='/var/www/html/findyourdesire/unapproved/'.$key.'.'.$un.'.jpg';
move_uploaded_file($_FILES[$key]['tmp'], $to);
$warns[]="$value was uploaded sucessfully"; # incase something else went wrong
}
}
}
?>