Created
September 30, 2009 06:14
-
-
Save dwiash/197862 to your computer and use it in GitHub Desktop.
Simple file uploader (PHP)
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
<?php | |
if($_POST['submit'] == "submit"){ | |
$uploaddir = $_POST['dir']; | |
$uploadfile = $uploaddir . basename($_FILES['file']['name']); | |
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { | |
echo "<span style='color:#00f' >File was successfully uploaded.</span><hr />"; | |
} | |
else | |
{ | |
echo "<span style='color:#f00' >Upload failed!</span><hr />"; | |
} | |
} | |
?> | |
<form enctype="multipart/form-data" method="post"> | |
<input type="text" name="dir" value="./" /> (upload directory) | |
<br> | |
<input type="file" name="file" /> | |
<input type="submit" name="submit" value="submit" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment