Upload Folder
*
Select a file below, or pick a file to upload:
*
*
*
*
* Because of the .htaccess options. .header.html will be included
* before the files are listed, presenting the upload button.
*/
$folder=$_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['SCRIPT_NAME']) . "/";
$host = "http://" . $_SERVER['HTTP_HOST'];
function show_err($s) {
echo "\n";
echo "Upload Error\n";
printf("%s
\n", $s);
printf("Return To Folder\n",
$_SERVER['HTTP_HOST'],
dirname($_SERVER['SCRIPT_NAME']));
echo "\n";
exit(0);
}
// Do nothing if no file
if(!array_key_exists('upload',$_FILES)) exit(0);
if(!posix_access($folder, POSIX_W_OK))
show_err("Can't Write to Folder");
if(0) if(stat( $_FILES["upload"]["name"]))
show_err("Can't Overwrite File");
// Prevent overwriting of .header, .htaccess, .htpasswd,
// or moving up directories
if($_FILES["upload"]["name"][0] == ".")
show_err("Access Denied");
if(!move_uploaded_file($_FILES["upload"]["tmp_name"],
$folder . basename($_FILES['upload']["name"])))
show_err("Couldn't Move File");
header("Location: http://" . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['SCRIPT_NAME']));
exit(0); ?>