Skip to content

Instantly share code, notes, and snippets.

@sudarshanReddykurri
Created May 25, 2017 07:38
Show Gist options
  • Save sudarshanReddykurri/9698af55a2734318155d4b6653fb59a3 to your computer and use it in GitHub Desktop.
Save sudarshanReddykurri/9698af55a2734318155d4b6653fb59a3 to your computer and use it in GitHub Desktop.
PHP FIle Upload
<form action="testfile.php" method="post" enctype="multipart/form-data" name="form1">
<input type="file" name="upload_file" id="resume">
<input type="submit" name="SubmitBtn" id="SubmitBtn" value="UPLOAD">
</form>
<?php
if(isset($_POST["SubmitBtn"])){
if($_FILES["upload_file"]["error"]){
echo "File Could Not be Uploaded";
}else{
move_uploaded_file($_FILES["upload_file"]["tmp_name"],"testUpload/".$_FILES["upload_file"]["name"]);
echo " File Uploaded Successfully";
header("refresh:2; url=file.html");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment