internet explorer 8 - IE8 doesn't prevent uploading with JQuery -


I have this code to prevent uploading large files (with JQuery-1.8.3. Would like to keep):

  & lt; Script type = "application / javascript" & gt; $ (Function () {var form = $ ("# add-attachment"); if (form.length! == 0) {var submit = false; form.on ('submit', function (e) {var file = $ ("Input [type = file]") [0]; if (submitted == incorrect) {e.preventDefault (); var file; if (typeof file.files === "undefined") fileOk = File; Else fileOk = file.files [0]; if (fileOk.size> 2000000) {Warning ("file is too large"); $ ("# add-attachment") [0]. Reset () ;} Else {submitted = true; $ (this) .submit ();}}});}}}; & Lt; / Script & gt; & Lt; Form id = "add-attachment" method = "post" enctype = "multipart / form-data" & gt; & Lt; Div id = "form" & gt; & Lt; Div & gt; & Lt; Label = "form_file" class = "required" & gt; & Lt; / Label & gt; & Lt; Input type = "file" id = "form_file" name = "form [file]" required = "required" & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" id = "form__token" name = "form [_token]" value = "4353454554544554545" & gt; & Lt; / Div & gt; & Lt; P & gt; Small & gt; Tamono Maximo: 2 MB & lt; / Small & gt; & Lt; / P & gt; & Lt; Input type = "submit" class = "btn" value = "adjuntar" & gt; & Lt; / Form & gt;  

This is executing only a warning when the file exceeds 2000000 B. But why is it not doing anything on IE8?


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -