# <input type="file"> Check image size onChange



## scrubbicus (Jan 23, 2009)

So I'm having some problems with uploading images on this script that I'm using I've done literally everything I could to try and limit the size of an image upload but I've decided to try this method.

What I'm trying to do is when a person selects an image in the file and then clicks off input (I'm guessing I'd use onChange?) I want to be able to run a function to check the size of that image right there before they can go upload another image.

I was hoping to do something like

">

then my checkImageSize function would check the size of the image but I don't know how to grab that image size without $_FILES['pic']['size'] which obvious requires the form to be submitted.


----------



## techSeekerX (Apr 16, 2007)

Hi
you could use an iframe to contain the form. Then submit the form on 'onchange' event of input file field.
Hope it helps.


----------

