Created
May 9, 2016 12:54
-
-
Save art-me/9de29797ed8885ee06847b577b1c0c9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Загрузка файлов на сервер</title> | |
</head> | |
<body> | |
<h2><p><b> Форма для загрузки файлов </b></p></h2> | |
<form action="upload.php" method="post" enctype="multipart/form-data"> | |
<input type="file" name="filename"><br> | |
<input type="submit" value="Загрузить"><br> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Результат загрузки файла</title> | |
</head> | |
<body> | |
<?php | |
if($_FILES["filename"]["size"] > 1024*200*1024) | |
{ | |
echo ("Размер файла превышает три мегабайта"); | |
exit; | |
} | |
// Проверяем загружен ли файл | |
if(is_uploaded_file($_FILES["filename"]["tmp_name"])) | |
{ | |
// Если файл загружен успешно, перемещаем его | |
// из временной директории в конечную | |
move_uploaded_file($_FILES["filename"]["tmp_name"], "/res/img/".$_FILES["filename"]["name"]); | |
} else { | |
echo("Ошибка загрузки файла"); | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment