Reply to Re: Restrict image by file size

Re: Restrict image by file size new!
by Ben, 14 years, 11 months ago
Hi Colin,

Thanks for the response. Yes, appreciate the value is small, the idea being that it will always fail, as I wanted to test catching the error in my app.

The issue i have is that once i add the $handle->file_max_size code, it fails. The log is as follows:

system information
- class version : 0.27
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
- MIME type detected as image/jpeg by PHP getimagesize() function
- source variables
file_src_name : DSCF0073.jpg
file_src_name_body : DSCF0073
file_src_name_ext : jpg
file_src_pathname : /tmp/phpL01Kyz
file_src_mime : image/jpeg
file_src_size : 69542 (max= 10485760)
file_src_error : 0
- source file is an image
image_src_x : 500
image_src_y : 375
image_src_pixels : 187500
image_src_type : jpg
image_src_bits : 8


My own logging shows:

FATAL: exception with message 'unlink(67e103b0761e60683e83c559be18d40c.) [function.unlink]: No such file or directory' in /home/boardh/web/index.php:80 Stack trace: #0 [internal function]: ErrorHandler(2, 'unlink(67e103b0...', '/home/boardh/ap...', 3036, Array) #1 /home/boardh/application/lib/upload.class.php(3036): unlink('67e103b0761e606...') #2 /home/boardh/application/controllers/photocontroller.php(92): upload->process('/home/boardh/we...') #3 [internal function]: photoController->upload() #4 /home/boardh/application/models/frontcontroller.php(78): ReflectionMethod->invoke(Object(photoController)) #5 /home/boardh/web/index.php(87): FrontController->route() #6 {main}

So it looks like im getting a "No such file or directory" caused by line 3036 of the class -
@unlink($this->file_dst_path . $hash . '.' . $this->file_dst_name_ext);

Any thoughts would eb appreciated, its got me stumped!!

Best regards, Ben.Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important