namita02
Design Dabbler

File size for attached files in k2 form

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.

Labels: (1)
0 Kudos
Reply
4 Replies
Prineel
Design Canvas Artiste

Re: File size for attached files in k2 form

Hi @namita02 ,

 

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

 

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

Reply
namita02
Design Dabbler

Re: File size for attached files in k2 form

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.
0 Kudos
Reply
namita02
Design Dabbler

Re: File size for attached files in k2 form

I am trying to do in List view as I have to attach multiple files.
0 Kudos
Reply
Prineel
Design Canvas Artiste

Re: File size for attached files in k2 form

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

0 Kudos
Reply