Page 1 of 1

MAX_FILE_SIZE / MAX_FILE_WIDTH

Posted: Mon Oct 24, 2005 2:10 pm
by $var
Hello,

I would like to make my uploads to limit the size, and dimensions of user input images.
It's working, however, there is no real prompt other than the image just doesn't upload.

How could I make this alert the user that they failed to pass the test.

Code: Select all

<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_WIDTH" value="150" />
<input type="hidden" name="MAX_FILE_SIZE" value="55000" />
I thought that I might need to use getimagesize(), but further research indicates that
to use that, the image needs to be on the server already (or on A server at least).

How could I determine that the File is too large or wide, and alert the user of which is wrong, if not both.

Thanks

Posted: Tue Oct 25, 2005 8:59 am
by feyd
the only way I know of to do it before the file is uploaded is using Javascript to load the image and checking the dimensions from there. However, you must still do the detection on the server once the file is uploaded as it's very easy to bypass your limiters (both width and size)