Вот мой скрипт. Под себя уже сам подстроишь.
CODE:<?
ob_implicit_flush();
?>
<html>
<head>
<title>SviMik's MegaUploader 1.0</title>
<style type="text/css">
form{display:inline;margin:0; padding:0;}
A:hover{color:#FFFFFF; background: #20478D;}
a{color: #EEFAFF;background: transparent;}
BODY, TABLE {font: 11px tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
color: #DEE0E2;
background: #0098CC;
border: solid 1px #DEE0E2;
scrollbar-base-color: #086693;
scrollbar-arrow-color: #EEF0F2;
scrollbar-track-color: #10375D;}
.input{font: 11px tahoma, verdana;color: #FF0000; border: 1px solid #000000; background-color: #FFFFFF}
</style>
</head>
<body>
<b>Закачать файлы:</b><BR>
<form name=upload method=POST ENCTYPE=multipart/form-data>
<input type=file name=userfile0 size=32 class=input><BR>
<input type=file name=userfile1 size=32 class=input><BR>
<input type=file name=userfile2 size=32 class=input><BR>
<input type=file name=userfile3 size=32 class=input><BR>
<input type=file name=userfile4 size=32 class=input><BR>
<input type=file name=userfile5 size=32 class=input><BR>
<input type=file name=userfile6 size=32 class=input><BR>
<input type=file name=userfile7 size=32 class=input><BR>
<input type=file name=userfile8 size=32 class=input><BR>
<input type=file name=userfile9 size=32 class=input><BR>
<input type=hidden name=updir value="../ghst/Upload/">
<input type="submit" class="button" value="Закачать!" accesskey="s" tabindex="3" style="font: 11px tahoma, verdana;"><BR>
</form>
<?
if($_FILES["userfile0"]!=="" && $_FILES["userfile0"]){saveuploadedfile('userfile0',$updir);}
if($_FILES["userfile1"]!=="" && $_FILES["userfile1"]){saveuploadedfile('userfile1',$updir);}
if($_FILES["userfile2"]!=="" && $_FILES["userfile2"]){saveuploadedfile('userfile2',$updir);}
if($_FILES["userfile3"]!=="" && $_FILES["userfile3"]){saveuploadedfile('userfile3',$updir);}
if($_FILES["userfile4"]!=="" && $_FILES["userfile4"]){saveuploadedfile('userfile4',$updir);}
if($_FILES["userfile5"]!=="" && $_FILES["userfile5"]){saveuploadedfile('userfile5',$updir);}
if($_FILES["userfile6"]!=="" && $_FILES["userfile6"]){saveuploadedfile('userfile6',$updir);}
if($_FILES["userfile7"]!=="" && $_FILES["userfile7"]){saveuploadedfile('userfile7',$updir);}
if($_FILES["userfile8"]!=="" && $_FILES["userfile8"]){saveuploadedfile('userfile8',$updir);}
if($_FILES["userfile9"]!=="" && $_FILES["userfile9"]){saveuploadedfile('userfile9',$updir);}
function saveuploadedfile($userfile,$updir){
if (move_uploaded_file($_FILES[$userfile]['tmp_name'], $updir.$_FILES[$userfile]['name'])) {
$fsize = $_FILES[$userfile]['size'];
$filesizename = array("", " КБ", " МБ", " ГБ", " ТБ", " PB", " EB", " ZB", " YB");
$fsize = round($fsize/pow(1024, ($i = floor(log($fsize, 1024)))), 2) . $filesizename[$i];
print "<BR><b>Файл ".$_FILES[$userfile]['name']." успешно закачен, и сохранён в папку ".$updir.$_FILES[$userfile]['name']."</b> Размер: ".$fsize." <BR>";
} else {
print "<pre>Possible file upload attack! Дополнительная отладочная информация:\n";
print_r($_FILES);
print "</pre>";
}
}
?>
</body>
</html> |