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.
Sometimes it goes through properly and other times it stops. It has worked for a jpg and a gif, and then I try to send a different jpg and it gets stopped.
I know it is the line of code that calls the process method because I put an echo before and after and it only said the first one.
I looked in the php error log and it didn't even throw an error there. So now I am lost as to what is happening.Reply
You need to raise the PHP memory limit, usually in php.ini. On shared hosting, you probably can't edit your php.ini, so you can try the following, although it will work only if the hosting company allows it, which they usually don't.
You can add this in your script:
ini_set ( "memory_limit", "40M")
Or in a .htaccess file:
php_value memory_limit 40M
If the above doesn't work, ask your hosting company.Reply
I don't think you can catch this error, as it is a fatal error. Moreover, if you are running out of memory, PHP will not have any more memory to use to actually deal with the error with an error handler. See here.Reply
This is the code that I am using...
Sometimes it goes through properly and other times it stops. It has worked for a jpg and a gif, and then I try to send a different jpg and it gets stopped.
I know it is the line of code that calls the process method because I put an echo before and after and it only said the first one.
I looked in the php error log and it didn't even throw an error there. So now I am lost as to what is happening.
Search for memory in the site, or click here.
You can also check this post.
You need to raise the PHP memory limit, usually in php.ini. On shared hosting, you probably can't edit your php.ini, so you can try the following, although it will work only if the hosting company allows it, which they usually don't.
You can add this in your script:
Or in a .htaccess file:
If the above doesn't work, ask your hosting company.
When I transfer this over to a shared hosting, I might not be able to change it.
If the hosting doesn't allow the additional memory, is there any way to exit the script without a fatal error.
Where I am using this code, it is necessary to be able to exit in a normal fashion in the case of an error.
Thanks for your help