">

" />
Logged out"; echo ""; exit; } else { echo "

Logged In

"; } ?>

Upload directory
Attempting Upload..."; for ( $x=0; $x<=$number_of_files-1; $x++ ) { # do it only if file has original name # prevents processing when nothing submitted if ( isset($_FILES[file_name][name][$x]) ) { # check for upload problems #### if ( $_FILES[file_name][error][$x] > 0 ) { echo " The file could not be upoaded because "; switch ( $_FILES[file_name][error][$x] ) { case 1: echo "the file is too big."; break; case 2: echo "the file is too big."; break; case 3: echo "the file was only partially uploaded."; break; case 4: echo "no file was uploaded."; break; case 6: echo "no temporary folder was available."; break; case 7: echo "unable to write to disk."; break; case 8: echo "file upload stopped"; break; default: echo "a system error occured."; } # end of switch echo "
"; exit; } #### end of if files > 0 #### if file uploaded, get extension else { $original_name = $_FILES[file_name][name][$x]; $original_name = trim($original_name); $type = explode(".", $original_name); $count = count($type); $last = $count-1; $type = "$type[$last]"; $type = strtolower($type); # test extension type if ( !in_array( $type, $allowed) ) { echo "
File type ($type) is not allowed
"; } # then see if it is small enough elseif ( $_FILES[file_name][size][$x] > $max_size ) { echo "
File is too big
"; } # if no errors and small enough, sanititize name else { # if no new name use original name if ( $_POST[new_name][$x] == "" ) { # snip extension $original_name = str_replace( ".$type", "", $original_name); # sanitize original name $original_name = preg_replace("@[^\w\.]@", "_", $original_name); # add extension and directory path to clean name $file_name = "$path$original_name.$type"; } # if new name submited, use it else { # sanitize new name $newname = $_POST[new_name][$x]; $newname = trim($newname); $newname = preg_replace("@[^\w\.]@", "_", $newname); # add extension and directory path to clean name $file_name = "$path$newname.$type"; } # prevent overwriting if $overwrite is "no" if ( $overwrite == "no" && file_exists($file_name) ) { echo "File $file_name already exists.
"; } # move uploaded file to upload directory # suppress PHP error message elseif ( @move_uploaded_file($_FILES[file_name][tmp_name][$x], $file_name) ) { echo "File uploaded to $file_name.
"; } # if move fails, give your own error message. else { echo "An error occured. File Not uploaded
"; } } echo "

"; } } # end isset file name } echo ""; exit; # end upload } ?>
" method="POST"> " /> " border="1" cellpadding="10"> "; } ?>
  • Limit KB each.
  • Renaming is optional.
  • Leave "New Name" field blank to retain original name.
  • Do not include extension in new name.
  • Periods and illegal characters will be replaced with underscores.
  • Allowed file types: $val) { echo "$val, "; } if ( $overwrite == "no" ) { echo "
  • Overwrite protection is on."; } else { echo "
  • Overwrite protection is off."; } ?>
Files New Name
"; echo ""; echo ""; echo ""; echo "