error_log('accept array is set'); /** * This is a sample file upload handler script that demonstrates how files * can be accepted or rejected based on it's extension. * * You can define a list of allowed types in the $allowed array, only files * with matching extensions will be accepted. Alternatively you can define * a list of file types to be rejected using the $reject array. Any file with * a matching extension will be rejected while all other file types will be * considered safe. * * If both $allow and $reject are defined, $accept takes precedence. Please use * lower case extensions. * */ ?>
| Files Uploaded | |||||
| ' . $file['name'][$i] ." | \n"; echo '' . $file['size'][$i] ." | \n"; $fileName = basename($file['name'][$i]); $parts = split('\.',$fileName); $ext = strtolower($parts[count($parts)-1]); if(is_array($accept)) { if(in_array($ext,$accept)) { /** * the file is of a type that is listed in the $accept array * let's accept it and save it to the hard disk if the * save_path is set */ echo "Accepted | "; if(isset($save_path) && $save_path!="") { move_uploaded_file($file['tmp_name'][$i], $save_path . $name[count($name)-1]); } } else { echo "Rejected | "; } } else if(is_array($reject)) { /* * we will inspect the file extension and reject the file, * should we find it's extension listed in the $rejects * array. */ if(in_array($ext,$reject)) { echo "Rejected | "; } else { echo "Accepted | "; if(isset($save_path) && $save_path!="") { move_uploaded_file($file['tmp_name'][$i], $save_path . $name[count($name)-1]); } } } echo "
| Files have not been saved, please edit upload.php to match your configuration | |||||
| Top level folder hint : $userfile_parent | |||||
Sample PHP Upload handler provided by Rad Inks
have you seen our Secure FTP Applet or our Multimedia Messaging Solution?