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.
t开发者_如何学Chanks in advance.
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.
精彩评论