Displaying error message when Mime Type is failed

Last post 05-07-2013, 7:23 PM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  05-07-2013, 10:33 AM 77370

    Displaying error message when Mime Type is failed

    Hi,

     

    I have used 'EnableMimeTypeChecking' attribute and set it to 'true'.

    Now I am trying to Upload a renamed xml file to zip. It does not upload to the portal neither gives an error message for this.

     

    So, I want to dispaly an error message here to the user when MimeTypeCheck fails. Is there any way or attribute which we can set to display the error message?


  •  05-07-2013, 12:07 PM 77372 in reply to 77370

    Re: Displaying error message when Mime Type is failed

    Hi MayurNarsale,

     

    You can catch the error by the API below and shows your custom error message. Message "The file is corrupt or has an incorrect extension. " is the default error message for mime type error.

     

    1. <script type="text/javascript">  
    2.     function CuteWebUI_AjaxUploader_OnError(msg) {  
    3.         if (msg.indexOf("The file is corrupt or has an incorrect extension") != -1) {  
    4.             //show the message you want  
    5.             alert("custom error message!");  
    6.             return false;  
    7.         }  
    8.     }  
    9. </script>  
     

    Regards,

     

    Ken 

  •  05-07-2013, 12:49 PM 77375 in reply to 77372

    Re: Displaying error message when Mime Type is failed

    Hi,

     

    Thanks for the quick response.

     

    Don't we have a attribute to set the error message for wrong Mime Type like we have 'MaxFilesLimitMsg', 'FileTooLargeMsg', 'FileTypeNotSupportMsg'?

  •  05-07-2013, 7:23 PM 77385 in reply to 77375

    Re: Displaying error message when Mime Type is failed

    Hi MayurNarsale,

     

    Has not provide the property setting for myme type error message, the only way for now is catch the error like the example code I sent. Sorry for your inconvenience.

     

    Regards,

     

    Ken 

View as RSS news feed in XML