class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
print_r($_FILES) = Array
(
[src] => Array
(
[name] => cogs.svg
[type] => image/svg+xml
[tmp_name] => /usr/tmp/phpr4j7ar
[error] => 0
[size] => 3385
)
)
Logs:
system information
- class version : 0.35dev
- operating system : FreeBSD
- PHP version : 5.6.36
- GD version : 2.1.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 50M (52428800 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Fileinfo PECL extension deactivated
- Checking MIME type with UNIX file() command
MIME type detected as image/svg; charset=us-ascii by UNIX file() command
- MIME validated as image/svg
source variables
- You can use all these before calling process()
file_src_name : cogs.svg
file_src_name_body : cogs
file_src_name_ext : svg
file_src_pathname : /usr/tmp/phpr4j7ar
file_src_mime : image/svg
file_src_size : 3385 (max= 52428800)
file_src_error : 0
process file to ../../uploads/slides/kitchen-test/
- file size OK
- file mime OK : image/svg
- file name safe format
- destination variables
file_dst_path : ../../uploads/slides/kitchen-test/
file_dst_name_body : cogs
file_dst_name_ext : svg
- checking for auto_rename
- destination file details
file_dst_name : cogs.svg
file_dst_pathname : ../../uploads/slides/kitchen-test/cogs.svg
- cogs.svg doesn't exist already
- ../../uploads/slides/kitchen-test/ doesn't exist. Attempting creation: failed
- error: Destination directory can't be created. Can't carry on a process.