Limit uploader max file size?

I have a problem with my upload logic. IIS (Microsoft) returns a server error of 404 when the file size in the POST exceeds the maximum file size configured on the server. However, webix does not catch this in the callback of the send-method.

In other words, there is an error happening, but I can’t seem to find a way to display a custom message to the user (to inform them about the file size).

Is there some way of limiting the file size BEFORE sending the file?
Is there otherwise a way to define an error-callback when sending fails?

I can’t seem to find anything in the documentation.

Hi,

You can use onFileUploadError event of the uploader

Is there some way of limiting the file size BEFORE sending the file? Is there otherwise a way to define an error-callback when sending fails?

For such task, you can use onBeforeFileAdd add of uploader

$$("uploader").attachEvent("onBeforeFileAdd", function(file){
    //ignore big files
    if (file.size && file.size > 4000000) return false;
});

As result, big files will not be sent to a server side

That works great! Thank you for the fast reply.

One small remark: the example in the link you provided has the wrong handler name. It says “onFileUpload” intead of “onFileUploadError”

Yep, will fix it. Thanks for reporting the issue.