Last active
August 9, 2022 07:00
-
-
Save amriunix/a8dc7f8685c211c8421859ed0208039d to your computer and use it in GitHub Desktop.
PHP Upload file
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Upload your files</title> | |
</head> | |
<body> | |
<form enctype="multipart/form-data" action="upload.php" method="POST"> | |
<p>Upload your file</p> | |
<input type="file" name="file"></input><br /> | |
<input type="submit" value="Upload"></input> | |
</form> | |
</body> | |
</html> | |
<?PHP | |
// https://stackoverflow.com/questions/2184513/change-the-maximum-upload-file-size | |
// Please adjust the maximum allowed size (upload_max_filesize) for uploaded and post request (post_max_size) in the php.ini file | |
if(!empty($_FILES['file'])) | |
{ | |
$path = "./"; | |
$path = $path . basename( $_FILES['file']['name']); | |
if(move_uploaded_file($_FILES['file']['tmp_name'], $path)) { | |
echo "The file ". basename( $_FILES['file']['name']). | |
" has been uploaded"; | |
} else{ | |
echo "There was an error uploading the file, please try again!"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Powershell UPLOAD Script