$file) { if(in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) { $upload_file = new UploadFile($k); // check the file if($upload_file->confirm_upload()) { $dest = $cachedir.basename($upload_file->get_stored_file_name()); // target name $guid = create_guid(); if($upload_file->final_move($guid)) { // move to uploads $path = $upload_file->get_upload_path($guid); // if file is OK, copy to cache if(verify_uploaded_image($path) && copy($path, $dest)) { $ret[] = $dest; } // remove temp file unlink($path); } } } } if (!empty($ret)) { $json = getJSONobj(); echo $json->encode($ret); //return the parameters }