File size for attached files in k2 form

  • 22 April 2021
  • 4 replies
  • 366 views

I need to get file size of uploaded files in the form.and after adding all file sizes of uploaded files I have to show error that files uploaded are exceeding the max limit.so please let me know how to get the file sizes of the uploaded files in the form.


4 replies

Hi @namita02 ,


 


The file attachment control has a validation "tool" built in:


 


Simply type out the max amount of file size in the property console (on the right side of the screen), once a user puts a file arger than the specified limit, the file will not upload with an error like this:
"The file is larger than the maximum size (1 MB)."


Hope this helps 🙂


 


Kind Regards


Prineel

Thanks Prineel for your suggestion.
But My form can attach 10 attachments. My requirement is total of those attachments should not exceed 30 MB. If I follow the suggestion provided by you above, it will restrict only for individual Attachment if it exceeds 30 MB. Can you please guide me.
I am trying to do in List view as I have to attach multiple files.

Hi @namita02,


 


I dont think that it is possible to get the size of the attached control using K2 as there is nothing that gives you the size. You might be able to get it through javascript or some from of scripting since the file size does display in the control's elements on a browser's dev tools, but that may be difficult. The only alternative that I can think of, is to limit each attachment control, but that would mean you will only have a limited number of them.


 


Kind Regards


Prineel

Reply