Created
October 11, 2014 01:06
-
-
Save MrRaindrop/36a930d99135654e33b6 to your computer and use it in GitHub Desktop.
php: upload file
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>testUpload</title> | |
</head> | |
<body> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" | |
enctype="multipart/form-data"> | |
<br/>upload file: | |
<br/><input type="file" name="test" /> | |
<br/><input type="submit" value="submit" /> | |
</form> | |
</body> | |
</html> | |
<?php | |
if (isset($_FILES['test'])) { | |
// if (is_uploaded_file($_FILES['test']['tmp_name'])) { | |
// copy($_FILES['test']['tmp_name'], __DIR__ . "\\uploads\\" . $_FILES['test']['name']); | |
// } else { | |
// echo "<p>Potential script abuse attempt detected.</p>"; | |
// } | |
move_uploaded_file( | |
$_FILES['test']['tmp_name'], | |
__DIR__. "\\uploads\\" . $_FILES['test']['name'] | |
); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment