1

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

 </form>
Bhanu Krishnan
  • 3,726
  • 1
  • 20
  • 40
user236501
  • 8,538
  • 24
  • 85
  • 119
  • possible duplicate of [Using jQuery, Restricting File Size Before Uploading](http://stackoverflow.com/questions/307679/using-jquery-restricting-file-size-before-uploading) – BalusC Jun 30 '11 at 06:08
  • I read that question already, can't find any answer from that question. – user236501 Jun 30 '11 at 06:17
  • This [Question's](http://stackoverflow.com/questions/307679/using-jquery-restricting-file-size-before-uploading) answer can help – Bhanu Krishnan Jun 30 '11 at 06:03

0 Answers0