check image size before upload [duplicate]
Possible Duplicate:
checking image size before upload
I want to check image size before upload photo using JavaScript
- Max width = 1024px
- Max Hight = 800px
How can this be done?
<script>
<!-- HERE MY QUESTION -->
</script>
<form name="forms" action="#" method="post" enctype="multipart/form-data" onsubmit="return check();">
<input type="file" name="img_name" /><br />
<input type="submit" valu开发者_如何学Goe="Upload" />
</form>
You can't access the image until it has been uploaded to your server, or if you use Flash to do it.
On upload, you can use list($width, $height) = getimagesize($_FILES['file']['tmp_name'])
for example, using PHP. If the dimensions exceed your specification, remove the file and alert the user.
精彩评论