JSP文件上传限制大小

时间:2011-06-30 05:55:02

标签: javascript jquery file jsp size

以下是我的上传照片代码。如何限制照片尺寸? jquery有这个功能吗?我谷歌搜索已经找不到了,但是说在客户端找不到文件大小?

   $().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" accept="gif|jpeg|bmp|png|jpg"/>
      </td>
  </tr>

 </form>

0 个答案:

没有答案