Created
January 24, 2019 15:27
-
-
Save vah13/1e14c1d19b20266e5090112785519478 to your computer and use it in GitHub Desktop.
Evil content-disposition
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
<html> | |
<body> | |
<form action="upload.phtml" method="post" enctype="multipart/form-data"> | |
Select image to upload: | |
<input type="file" name="fileToUpload" id="fileToUpload"> | |
<input type="submit" value="Upload Image" name="submit"> | |
</form> | |
</body> | |
</html> | |
<?php | |
if (isset($_FILES['fileToUpload']) and pathinfo($_FILES['fileToUpload']['name'])['extension']=='jpg') | |
{ | |
$uploaddir = '/var/www/html/uploads/'; | |
$uploadfile = $uploaddir . basename($_FILES['fileToUpload']['name']); | |
if (move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $uploadfile)) { | |
echo "File is valid, and was successfully uploaded.\n"; | |
} | |
else { | |
echo "Upload failed"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment