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.
I've just tried the class but I always get an error telling me my file is too big. Regardless the file_max_size I set. Even with a 1Kb file I don't get pass the size check. What is the problem ?Reply
system information - class version : 0.28 - GD version : 2.0.28 - supported image types : png jpg gif bmp - open_basedir : /var/www/vhosts/vriens.be/subdomains/cafeminerva/httpdocs:/tmp - language : nl_NL source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command UNIX file() command failed - Checking MIME type with mime.magic file (mime_content_type()) MIME type detected as by mime_content_type() - Checking MIME type with getimagesize() getimagesize() failed - MIME type detected as Array by browser - Try to guess MIME type from file extension (): MIME type set to Array - MIME type couldn't be detected! (Array) source variables - You can use all these before calling process() file_src_name : Array file_src_name_body : Array file_src_name_ext : file_src_pathname : Array file_src_mime : Array file_src_size : Array (max= 2097152) file_src_error : Array process file to /fotos/stamgasten/ - error: Het bestand is te groot.Reply
system information - class version : 0.28 - GD version : 2.0.28 - supported image types : png jpg gif bmp - open_basedir : /var/www/vhosts/vriens.be/subdomains/cafeminerva/httpdocs:/tmp - language : nl_NL source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command UNIX file() command failed - Checking MIME type with mime.magic file (mime_content_type()) MIME type detected as by mime_content_type() - Checking MIME type with getimagesize() getimagesize() failed - MIME type detected as Array by browser - Try to guess MIME type from file extension (): MIME type set to Array - MIME type couldn't be detected! (Array) source variables - You can use all these before calling process() file_src_name : Array file_src_name_body : Array file_src_name_ext : file_src_pathname : Array file_src_mime : Array file_src_size : Array (max= 2097152) file_src_error : Array process file to /fotos/stamgasten/ - error: Het bestand is te groot.Reply
Hello Colin, I think i've managed to get a bit further by implementig the code you provide in the Q&A about the multiple uploads.
But now I get an error telling me this : system information - class version : 0.28 - GD version : 2.0.28 - supported image types : png jpg gif bmp - open_basedir : /var/www/vhosts/vriens.be/subdomains/cafeminerva/httpdocs:/tmp - language : source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command UNIX file() command failed - Checking MIME type with mime.magic file (mime_content_type()) MIME type detected as by mime_content_type() - Checking MIME type with getimagesize() getimagesize() failed - MIME type detected as by browser - Try to guess MIME type from file extension (gif): MIME type set to image/gif - can't retrieve image information. open_basedir restriction in place? source variables - You can use all these before calling process() file_src_name : wilfried.gif file_src_name_body : wilfried file_src_name_ext : gif file_src_pathname : file_src_mime : image/gif file_src_size : (max= 2097152) file_src_error : - source file is an image image_src_x : image_src_y : image_src_pixels : image_src_type : gif image_src_bits : process file to ../fotos/stamgasten/ - file size OK - file mime OK : image/gif - no image properties available, can't enforce dimension checks : image/gif - file name safe format - destination variables file_dst_path : ../fotos/stamgasten/ file_dst_name_body : wilfried file_dst_name_ext : gif - no image operation, keep extension - checking for auto_rename - destination file details file_dst_name : wilfried.gif file_dst_pathname : ../fotos/stamgasten/wilfried.gif - wilfried.gif doesn't exist already - attempting to use a temp file: failed - error: Can't create the temporary file. Can't carry on a process.Reply
Regardless the file_max_size I set. Even with a 1Kb file I don't get pass the size check.
What is the problem ?
- class version : 0.28
- GD version : 2.0.28
- supported image types : png jpg gif bmp
- open_basedir : /var/www/vhosts/vriens.be/subdomains/cafeminerva/httpdocs:/tmp
- language : nl_NL
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
UNIX file() command failed
- Checking MIME type with mime.magic file (mime_content_type())
MIME type detected as by mime_content_type()
- Checking MIME type with getimagesize()
getimagesize() failed
- MIME type detected as Array by browser
- Try to guess MIME type from file extension (): MIME type set to Array
- MIME type couldn't be detected! (Array)
source variables
- You can use all these before calling process()
file_src_name : Array
file_src_name_body : Array
file_src_name_ext :
file_src_pathname : Array
file_src_mime : Array
file_src_size : Array (max= 2097152)
file_src_error : Array
process file to /fotos/stamgasten/
- error: Het bestand is te groot.
Can you add this at the start of your script:
And then copy here what it says.
When I add the code you provided it doesn't show anything.
I get the following output:
system information
- class version : 0.28
- GD version : 2.0.28
- supported image types : png jpg gif bmp
- open_basedir : /var/www/vhosts/vriens.be/subdomains/cafeminerva/httpdocs:/tmp
- language : nl_NL
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
UNIX file() command failed
- Checking MIME type with mime.magic file (mime_content_type())
MIME type detected as by mime_content_type()
- Checking MIME type with getimagesize()
getimagesize() failed
- MIME type detected as Array by browser
- Try to guess MIME type from file extension (): MIME type set to Array
- MIME type couldn't be detected! (Array)
source variables
- You can use all these before calling process()
file_src_name : Array
file_src_name_body : Array
file_src_name_ext :
file_src_pathname : Array
file_src_mime : Array
file_src_size : Array (max= 2097152)
file_src_error : Array
process file to /fotos/stamgasten/
- error: Het bestand is te groot.
See the section called What about multiple uploads in the FAQ.
I think i've managed to get a bit further by implementig the code you provide in the Q&A about the multiple uploads.
But now I get an error telling me this :
system information
- class version : 0.28
- GD version : 2.0.28
- supported image types : png jpg gif bmp
- open_basedir : /var/www/vhosts/vriens.be/subdomains/cafeminerva/httpdocs:/tmp
- language :
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
UNIX file() command failed
- Checking MIME type with mime.magic file (mime_content_type())
MIME type detected as by mime_content_type()
- Checking MIME type with getimagesize()
getimagesize() failed
- MIME type detected as by browser
- Try to guess MIME type from file extension (gif): MIME type set to image/gif
- can't retrieve image information. open_basedir restriction in place?
source variables
- You can use all these before calling process()
file_src_name : wilfried.gif
file_src_name_body : wilfried
file_src_name_ext : gif
file_src_pathname :
file_src_mime : image/gif
file_src_size : (max= 2097152)
file_src_error :
- source file is an image
image_src_x :
image_src_y :
image_src_pixels :
image_src_type : gif
image_src_bits :
process file to ../fotos/stamgasten/
- file size OK
- file mime OK : image/gif
- no image properties available, can't enforce dimension checks : image/gif
- file name safe format
- destination variables
file_dst_path : ../fotos/stamgasten/
file_dst_name_body : wilfried
file_dst_name_ext : gif
- no image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : wilfried.gif
file_dst_pathname : ../fotos/stamgasten/wilfried.gif
- wilfried.gif doesn't exist already
- attempting to use a temp file: failed
- error: Can't create the temporary file. Can't carry on a process.