Below are my upload photo code. How to limit the photo size? Does jquery has this function? I google search already can't find any, but said can't find the file size on client side?
$().ready(function() {
// validate signup form on keyup and submit
$("#new_product").validate({
rules: {
item_picture: {
required: true,
accept: "jpg|gif|png"
}
},
messages: {
item_picture: {
required:"Please choose an item picture",
accept:"File type was invalid"
}
},
errorElement: "div" //
});
});
<form action="create_auction_item" enctype="multipart/form-data" class="new_product" id="new_product" method="post" style=" padding: 20px;">
......
<tr>
<th>
<label for="picture">Item Picture<span style="color:red;">*</span></label>
</th>
<td>
<input id="item_picture" name="item_picture" size="30" type="file" a开发者_JAVA百科ccept="gif|jpeg|bmp|png|jpg"/>
</td>
</tr>
</form>
精彩评论