config.php:
Kod:
<?
//Advanced Uploader V1.00b
//Copyright 2002 ZachWhite.com
//By using this program you agree with the license provide with it.
//Script by Zach White http://www.zachwhite.com [email protected]
$absolute_path = "/my/path/upload/"; //Absolute path to where files are
$size_limit = "yes"; //do you want a size limit yes or no.
$limit_size = "20000000"; //How big do you want size limit to be in bytes
$limit_ext = "no"; //do you want to limit the extensions of files uploaded
$ext_count = "4"; //total number of extensions in array below
$extensions = array(".gif", ".jpg", ".jpeg", ".png"); //List extensions you want
?>
index.php:
Kod:
<?
switch($upload) {
default:
include "config.php";
echo "
<html>
<head>
<title>Upload</title>
</head>
<body topmargin=\"10\" leftmargin=\"0\" bgcolor=\"#18576F\" link=\"#818EA0\" vlink=\"#5C697A\" alink=\"#818EA0\" text=\"#FFFFFF\" style=\"font-family: Verdana; font-size: 12pt; color: #FFFFFF$
Send a file to najk:<br>
<form method=\"POST\" action=\"$PHP_SELF?upload=doupload\" enctype=\"multipart/form-data\">
<input type=file name=file size=30 style=\"font-family: v; font-size: 12pt; color: #5E6A7B; border: 1px solid #5E6A7B; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1\"><$
<br>
<input name=\"submit\" type=\"submit\">
</form>
</body>
</html>";
break;
case "doupload":
include "config.php";
$endresult = "<font size=\"2\">File Was Uploaded</font>";
if ($file_name == "") {
$endresult = "<font size=\"2\">No file selected</font>";
}else{
if(file_exists("$absolute_path/$file_name")) {
$endresult = "<font size=\"2\">File Already Existed</font>";
} else {
if (($size_limit == "yes") && ($limit_size < $file_size)) {
$endresult = "<font size=\"2\">File was to big</font>";
} else {
$ext = strrchr($file_name,'.');
if (($limit_ext == "yes") && (!in_array($ext,$extensions))) {
$endresult = "<font size=\"2\">File is wrong type</font>";
}else{
@copy($file, "$absolute_path/$file_name") or $endresult = "<font size=\"2\">Couldn't Copy File To Server</font>";
}
}
}
}
echo "
<html>
<head>
<title>Upload</title>
</head>
<body topmargin=\"10\" leftmargin=\"0\" bgcolor=\"#18576F\" link=\"#818EA0\" vlink=\"#5C697A\" alink=\"#818EA0\" text=\"#FFFFFF\" style=\"font-family: Verdana; font-size: 12pt; color: #FFFFFF$
$endresult<br>
</body>
</html>";
break;
}
?>