<?php
Function getUploadedFile($filefield, $index, $destination, $filetypes=FALSE, $echoIt=TRUE) { if ( is_array($_FILES[$filefield]) and $_FILES[$filefield]['error'][$index]['file']==0 and $_FILES[$filefield]['size'][$index]['file']>128 and $_FILES[$filefield]['tmp_name'][$index]['file']!="" // and in_array($_FILES[$filefield]['type'][$index]['file'], array("image/png", "image/gif", "image/jpg")) //...good luck listing all possible mime types... and (!is_array($filetypes) or in_array(strtolower(strrchr($_FILES[$filefield]['name'][$index]['file'], ".")), $filetypes)) and move_uploaded_file( $_FILES[$filefield]['tmp_name'][$index]['file'], $destination.=($UpL_name=basename($_FILES[$filefield]['name'][$index]['file'])) ) ) { if ($echoIt) echo "$filefield file: $UpL_name<br />\n"; return $destination; } else return NULL; } ?>
|