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
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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.