Question T3427
Visible to All Users

Possible to bypass file size upload limit by uploading multiple files at once

created 5 years ago
  1. Set 50 Mb of file size upload limit.
  2. Choose two files that are together more than 50 Mb's. (2020_02_17_13_41_21_Window.png)
    Result: No error message about file size upload limit bypassing.

Answers approved by surveyjs Support

created 5 years ago

Hello,

The maxSize option applies to each selected file, not to the whole size. You can introduce a new property, let's say totalSize. You can check this property in the onUploadFiles event handler before start uploading and inform user about limit exceed.

A new property can be added via the following code:

JavaScript
Survey.Serializer.addProperty("file", "maxSize:number");

and can be accessed via the question.maxSize code.

Does it fit your needs?

Thanks, Serge
SurveyJS Team

    Comments (3)

      Hi,

      Is it possible to force the File field to show the error message in case if we implement the custom check? If not is there a way to show custom error messages?

      Regards
      Gergő Oroszi

        Hello,

        Sure. Here is the code:

        JavaScript
        question.errors.push(new Survey.ExceedSizeError(question.maxSize, question));

        Thanks, Serge
        SurveyJS Team

          Thanks, This should help fixing the issue.