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?

 

Parents Reply Children
No Data