jquery - the input file type image size restriction is not working -


Actually i tried jquery image file verification with this url, but this is not working. Can you confirm and advise me?


Click here:

  & lt; Form method = "post" enctype = "multipart / form-data" id = "upload_form" & gt; & Lt; Input type = "file" name = "example_file" name = "example_file" & gt; & Lt; Button type = "submit" & gt; Upload & lt; / Button & gt; & Lt; / Form & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script src = "https://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Validate ({Rule: {example_file: {fileType: {types: ["text", "gzip", "zip"]}, maxFileSize: {"unit" "KB", "size": 100}, minFileSize: {"unit": "KB", "size": "10"}}})}} & lt; / scripts & gt;  < / Pre> 

If you want to use the extension so that not enough to be just including jquery and jquery.validate. Add the plugin also by downloading (I know that this is missing in the example)

The last solution should be something like this:

  
method = "post "Enctype =" multipart / form-data "id =" upload_form "& gt; Lt; input type = "file" name = "example_file" name = "example_file" & gt; button type = "submit" & gt; upload & lt; / button & gt; & lt; / form & Gt; & lt; script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>;;;;;;;;;;;;); lt; script src =" https: / /ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js "& gt; & Lt; / Script & gt; & Lt; Script src = "jquery.validate.file.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Validate ({Rule: {example_file: {fileType: {types: ["text", "gzip", "zip"]}, maxFileSize: {"unit" "KB", "size": 100}, minFileSize: {"unit": "KB", "size": "10"}}})}} & lt; / scripts & gt; < / Pre>

Edit: Testing of uploadfunction in jsfiddle is not the best idea, cuz does not normally allow file uploads.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -