Jump to content

script wont validate image upload


allaboutthekick

Recommended Posts

for some reason this script wont validate the image that is trying to be uploaded correctly....

I would usually post the script on a link but due to restrictions it wont allow me to post in code box.

http://phpfreaks.pastebin.com/819524


I recieve this error while trying to upload an image that is too large.....
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 7728 bytes) in /nfs/cust/6/85/82/728586/web/upload.php on line 95
Link to comment
https://forums.phpfreaks.com/topic/26533-script-wont-validate-image-upload/
Share on other sites

That means you ran out of memory.. and yes it's because the image is too large :)

You can either increase the available memory:

ini_set('memory_limit', '128M');

Or you can use the image size to estimate memory needs, and reject any images which are too large to process.  Or maybe you can process the image another way, with command line tools for example.
around line 20 i have a image size checker is that incorrect? shouldnt that just do it right there?

also after i recieve the error message when trying to upload images that are too big it just leaves 2 files on the server....
one is $badd.jpg and the other is o$badd.jpg ($badd being the time and date of the upload as shown on line 30.
Ok well i did what you recommended and it worked, except it doesnt stop files that are over 500kb but its ok cause i just realized when i resize it i create a new file that is smaller so it doesnt matter what size they upload.

but it would still be nice to have image size checker, so people lets say cant upload images over 4mb

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.