In this case i am uploading an image using HTML and JavaScript.
I need to upload an image with only in the size of width->400 and height->400.
How can this be done using java script.
thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t think you can with Javascript (maybe with HTML5?). Regardless, you wouldn’t want to do input checking on the client side because users (not all) are malicious or perhaps could just javascript blocked.
A better “solution” is to let them upload it, check the width and height of the picture, and if isn’t what you want then present a message to the user like “Error: Picture is too big, decrease picture size!”
Or another solution would be to scale it for them to that size once they upload it.