tuckbloor / secure-image-upload
A PHP Class That Securely Uploads Images And Checks The MEME Type, If The Uploaded File Is Valid The Class Creates A New Image And Destroys The Old Image
dev-master
2019-02-21 14:20 UTC
Requires
- php: >= 5.3.0
Requires (Dev)
- filp/whoops: 2.3.*
This package is auto-updated.
Last update: 2024-05-22 01:33:19 UTC
README
A simple php script that securely uploads images
Checks the extension type
Checks the image size
Checks the image type using exif_imagetype
Renames the uploaded image with unique();
Recreates A new image from the uploaded image
The following are PHP requirements
- PHP >= 5.3
- GD Extension
- exif_imagetype function
For Testing
<?php
require_once __DIR__ . '/vendor/autoload.php';
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$test = new Siu\SecureImageUpload($_FILES);
$test->save();
}
?>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000"/>
<input type="file" name="Image"/>
<input type="submit" value="Upload"/>
</form>