Created
February 6, 2018 03:57
-
-
Save malikkurosaki/640cbafb9bd1eafa91c993f943721fbb to your computer and use it in GitHub Desktop.
super basic file upload
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
<form method="post" action="upload.php" enctype="multipart/form-data" > | |
<input type="file" name="up"> | |
<input type="submit" value="upload"> | |
</form> | |
//php upload.php | |
<?php | |
$dir = "../lib/"; //directory target upload file | |
$file = $dir.basename($_FILES['up']['name']); | |
define("SUKSES","sukses"); | |
define("GAGAL","gagal"); | |
if(move_uploaded_file($_FILES['up']['tmp_name'],$file)){ | |
echo SUKSES; //if succsses | |
}else{ | |
echo GAGAL; //if failur | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment