1

Is there is any method for validating the dimensions of the image file before uploading to the server ..

In details

I had a PHP file upload form and image upload will restrict with specific dimensions . Already I am checking in server side and also I wanna check the image dimensions before uploading process

Please help Thanks

2
  • 2
    I've only seen it done with flash / silverlight / exe / applet, never seen it with pure html yet, similar question asked here: stackoverflow.com/questions/8486414/… Commented Jan 30, 2012 at 6:14
  • until it is uploaded php has nothing to check. Commented Jan 30, 2012 at 6:24

2 Answers 2

2

Yes, it's possible. pupload for example can resize images on the client side.

Take a look at the HTML5 runtime source to see how it determines the dimensions.

Sign up to request clarification or add additional context in comments.

1 Comment

PLupload rocks! +1, Side note: "Image resizing is only possible on Firefox 3.5+ (with fixed quality) acnd Chrome. Safari/Opera doesn't support direct data access to the selected files." - plupload.com
1

Check this example http://jsfiddle.net/WQNzY/1/ I've created based on this great MDN tutorial

It make use of FileReader API, so you would like to check what browsers support it currently. Now it works in Mozilla, Chrome, Opera. But sure for old browsers you need anyway use server side validation. Not a big deal because you anyway need it alongside with client-side but for modern browsers you could make user experience more smooth and pleasent.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.