IIAHbI4
09.12.2007, 02:45
<?
// Загрузщик файлов powered by Пеныч длё ИЗИСО
$docr = $_SERVER['DOCUMENT_ROOT'];
echo <<<HTML
<b>Загрузить файл.</b>
<table>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="ac" value="upload">
<tr>
<td>Файл:</td>
<td><input size="48" name="file" type="file"></td>
</tr>
<tr>
<td>Папка:</td>
<td><input size="48" value="$docr/" name="path" type="text"><input type="submit" value="Загрузить"></td>
HTML;
if (isset($_POST['path'])){
$uploadfile = $_POST['path'].$_FILES['file']['name'];
if ($_POST['path']==""){$uploadfile = $_FILES['file']['name'];}
if (copy($_FILES['file']['tmp_name'], $uploadfile)) {
echo "Файл успешно загружен в папку $uploadfile\n";
echo "Имя:" .$_FILES['file']['name']. "\n";
echo "Размер:" .$_FILES['file']['size']. "\n";
} else {
print "Не удаётся загрузить файл. Инфо:\n";
print_r($_FILES);
}
}
?>
</td></tr></table>
</body>
</html>
// Загрузщик файлов powered by Пеныч длё ИЗИСО
$docr = $_SERVER['DOCUMENT_ROOT'];
echo <<<HTML
<b>Загрузить файл.</b>
<table>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="ac" value="upload">
<tr>
<td>Файл:</td>
<td><input size="48" name="file" type="file"></td>
</tr>
<tr>
<td>Папка:</td>
<td><input size="48" value="$docr/" name="path" type="text"><input type="submit" value="Загрузить"></td>
HTML;
if (isset($_POST['path'])){
$uploadfile = $_POST['path'].$_FILES['file']['name'];
if ($_POST['path']==""){$uploadfile = $_FILES['file']['name'];}
if (copy($_FILES['file']['tmp_name'], $uploadfile)) {
echo "Файл успешно загружен в папку $uploadfile\n";
echo "Имя:" .$_FILES['file']['name']. "\n";
echo "Размер:" .$_FILES['file']['size']. "\n";
} else {
print "Не удаётся загрузить файл. Инфо:\n";
print_r($_FILES);
}
}
?>
</td></tr></table>
</body>
</html>