javascript - How do I remove the default Alert that comes up with invalid format on AjaxFileUpload? -


i have ajaxfileupload control, , using jquery popup error wrong file type. ajaxfileupload, however, apparently has default, not-so-pretty alert comes when incorrect file type added. results in default alert showing, modal showing. cannot remove allowedfiletypes property because when unwanted file gets added anyway. know how rid of default alert ajaxfileupload throws?

<div class="upload-photos-add" id="q0012_00" runat="server">     <asp:ajaxfileupload enableviewstate="false" id="ajaxfileupload2"          contextkeys="0012.00" runat="server" allowedfiletypes="jpg,jpeg,png"           onuploadcomplete="ajaxfileupload_uploadcomplete"           onclientuploadcomplete="onclientuploadcomplete"           onclientuploadcompleteall="onclientuploadcompleteall"          onclientuploadstart="onclientuploadstart">      </asp:ajaxfileupload> </div> 

the function handles validation:

    function validatefilesize(input_event) {         //var valid_file = true;         var valid_format = true;         var valid_size = true;          var element_id = $(input_event).attr('id');          if(supports_html5_file_upload) {             var number_of_new_files = document.getelementbyid(element_id).files.length;              (var = 0; < number_of_new_files; i++) {                 var current_file = document.getelementbyid(element_id).files[i];                  var file_name = current_file.name;                  var file_path_array = file_name.split('.');                 var file_ext = file_path_array[file_path_array.length - 1];                 file_ext = file_ext.tolowercase();                  if(file_ext != 'jpg' && file_ext != 'jpeg' && file_ext != 'png') {                     //valid_file = false;                     valid_format = false;                 }                  if(ie7 || ie8 || ie9) {                     var sizeinbytes = 100;                 } else {                     var sizeinbytes = current_file.size;                 }                  var fsizemb = sizeinbytes / 1048576;                 if(fsizemb > 3) {                     //valid_file = false;                     valid_size = false;                 }              }          } else {              var current_file = document.getelementbyid(element_id);              var file_name = current_file.value;              var file_path_array = file_name.split('.');             var file_ext = file_path_array[file_path_array.length - 1];             file_ext = file_ext.tolowercase();              if(file_ext != 'jpg' && file_ext != 'jpeg' && file_ext != 'png') {                 //valid_file = false;                 valid_format = false;             }              if(fileapisupported) {                 //var sizeinbytes = current_file.size;                 var sizeinbytes = document.getelementbyid(element_id).files[0].size;             } else {                 var sizeinbytes = 100;             }              var fsizemb = sizeinbytes / 1048576;             if(fsizemb > 3) {                 //valid_file = false;                 valid_size = false;             }          }          if (!valid_size && !valid_format) {             $("#modal-file-size-format").modal('show');             document.getelementbyid(element_id).value = null;         }         else if (!valid_format) {             $("#modal-file-format").modal('show');             document.getelementbyid(element_id).value = null;         }         else if (!valid_size) {             $("#modal-file-size").modal('show');             document.getelementbyid(element_id).value = null;         }         else {             if(canvassupported && fileapisupported) {                 thumbnail_preview.update(document.getelementbyid(element_id).files, input_event);             } else {                 thumbnail_title_preview.update(document.getelementbyid(element_id).value, input_event);             }          }      } 

this alert functionality built ajaxcontroltoolkit. in order rid of it, downloaded ajaxcontroltoolkit source code , changed alert console log, recreated ajaxcontroltoolkit.dll , replaced in project.

confirmfileisinvalid: function (fileitem) {     /// <summary>     /// send alert user file type not acceptable. processor uses      /// method after validation.     /// </summary>     /// <param name="fileitem"></param>      var utils = new sys.extended.ui.ajaxfileupload.utils();     console.log(string.format(sys.extended.ui.resources.ajaxfileupload_wrongfiletype,                utils.getfilename(fileitem.value), fileitem.type)); } 

this alert coming up:

<data name="ajaxfileupload_wrongfiletype" xml:space="preserve">     <value>        can't add file '{0}' upload list. file type '{1}' not allowed     </value> </data> 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -