Skip to content

Instantly share code, notes, and snippets.

@malikkurosaki
Created February 6, 2018 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malikkurosaki/640cbafb9bd1eafa91c993f943721fbb to your computer and use it in GitHub Desktop.
Save malikkurosaki/640cbafb9bd1eafa91c993f943721fbb to your computer and use it in GitHub Desktop.
super basic file upload
<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