Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
675
Trap file extension error on client side
posted

I have an instance of WebUpload control that I need to configure to fire the Upload events on the server side, but I still want to trap when the user selects files with the wrong extension on the client side.

In my ascx file, I have coded

        <igjq:WebUpload ID="igUpload1"
            runat="server"
            OnUploadFinishing="igUpload1_OnUploadFinishing"
            OnUploadFinished="igUpload1_OnUploadFinished"
            OnUploadStarting="igUpload1_OnUploadStarting"> 
            <ClientEvents OnError="showAlert" />
        </igjq:WebUpload>

 

In the code behind (CS) file, I have

$.ig.loader(function () {
    $("#igUpload1").igUpload({
        mode: 'multiple',
        multipleFiles: true,
        maxUploadedFiles: 5,
        maxSimultaneousFilesUploads: 1,
        allowedExtensions: ["txt", "doc", "png"],
        progressUrl: "Services/IGUploadStatusHandler.ashx",
        controlId: "serverID1",
        iguploadonerror: function (e, args) {
            showAlert(e, args);
        },
        onError: function (e, args) {
            showAlert(e, args);
        }
    )};
)};

When I code the OnUploadStarting to cancel the event with a server message, the onError event does fire and I can display the message there.  This is good.

 

However, when I test the client side by selecting a file with a bad extension, neither error event fires.

What do I need to change to trap the OnError event on the client?

 

  • 3595
    posted

    Hello Gerald,

    Thank you for posting in our community!

    Have you tested this scenario by using the errorMessageValidatingFileExtension option for the igUpload?

    I have added a code snippet for your reference: 

    $(".selector").igUpload({

        errorMessageValidatingFileExtension : "File extension not supported"

    });

    More information on error message types could be found at the option tab of the following page: http://help.infragistics.com/jQuery/2013.1/ui.igupload

    If you have any further question feel free to contact me.