Showing posts with label safe. Show all posts
Showing posts with label safe. Show all posts

Saturday, May 28, 2016

Safe Upload

This class is made by Ahmed Selim Refaat Ahmed and can be used to process files uploaded via Web forms.

It checks a given uploaded file and performs several checks before processing it like: checking the file name against a black list of banned names, check if the file already exists in a target directory, check whether the file size is not zero nor exceeds and given limit, check the MIME type against a list of accepted types, check the file name extension against a list of accepted extensions.

Then the class processes the file by moving it to a target directory. If it succeeds, the class returns an array with several details about the file.

The package can be downloaded here (3 kb).