Upload
Download
";
break;
case 'download': print "Upload
Back
";
//Loop to show download links
$dir = opendir($dir_absolute);
while ( $file = readdir ($dir) ) {
if ( ($file != "..") and ($file != ".") ) {
$list .= "{$file}
";
}
}
print $list;
break;
case 'upload': print"Download
Back";
//The upload form
print "";
break;
case 'doupload': $dir = "dir";
//If the file has a name....then [statement]
if ( $file != "" ) {
if ( file_exists ( "{$dir_absolute}/{$file_name}" ) ) {
die ("File already exists, please rename.");
}
if ( ( $q_size_limit == "yes" ) && ( $file_size > $size_limit ) ) {
die ("File exceeds the upload size limit. It's got to be equal to, or less than {$size_limit}.");
}
$extension = strrchr ($file_name,'.');
if ( !in_array ( $extension,$ext_suffix_limit ) ) {
die ("You can't upload that file, it has an invalid extension.");
}
copy ( $file, "{$dir_absolute}/{$file_name}") or die ("Upload has failed to copy completely on the server. Please contact an admin about this, or change the file name and try again.");
} else {
die ("Select a file to upload.");
}
print "{$file_name} was uploaded successfully.
Upload
Back";
break;
}
?>