jquery - Validating input type=file -


How am I valid if the user has chosen an image or not, then click the upload button using jQuery . Can I ban the solution for the image being uploaded ?? Ex: - Only images above 900 x 400 resolution are allowed below. My form is

   

Below is jQuery:

  $ ("# eventImage"). Validate (validate {rule: {image_name: {expected: true}, // input type = file}, image_name: {new_name: "Please enter a category name!", Event_image: "Please select an image" }}); Take a look at  

$ (" Validate (# rule: {image_name: {expected: true}, event_image: {expected: true, extension: "png | jpg"}}, Message: {event_image: {extension: "Please select an image Choose "}}});

Demo:

Or, if you want to go with MIME type

  $ ("# eventImage"). Validate ({Rule: {image_name: {expected: true}, event_image: {expected: true, accept: "image / *"}}, Message: {event_image: {Accept: "Please select an image" }}});  

Demo:


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -