Skip to content

Instantly share code, notes, and snippets.

@ngocbd
Created September 25, 2016 12:24
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 ngocbd/4819ec62dc7afca1a644e8d3d5edeb21 to your computer and use it in GitHub Desktop.
Save ngocbd/4819ec62dc7afca1a644e8d3d5edeb21 to your computer and use it in GitHub Desktop.
<?php
$target_path = "";
$target_path = $target_path . basename( $_FILES['f']['name']);
if(move_uploaded_file($_FILES['f']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['f']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
<form enctype="multipart/form-data" action="" method="POST">
<input name="f" type="file" />
<input type="submit" value="S" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment