159
Views
4
Comments
How to check file size client side?

Hello Community,

I'm new to this OS world.

I want to upload file to the server but before uploading it to the server, I want to check it's size at client side.

If file size is more than 5 MB, I want to show error message like this.

I'm using upload file widget but not sure how do I implement javascript over there.

Can someone please advice?

Thanks and Regards,

Royal Naidu

Champion
Rank: #389

Please check out this forge component. May be you can extend it to check even the size of file.

https://www.outsystems.com/forge/component-overview/3163/file-extension-validation-client-side

mvp_badge
MVP
Rank: #113

Hi Royal,

You can use GetFileSize client action from this forge component if you are developing with reactive web or mobile app. It will return file size in bytes so do the conversion accordingly before comparing.

Champion
Rank: #39

Royal Naidu wrote:

Hello Community,

I'm new to this OS world.

I want to upload file to the server but before uploading it to the server, I want to check it's size at client side.

If file size is more than 5 MB, I want to show error message like this.

I'm using upload file widget but not sure how do I implement javascript over there.

Can someone please advice?

Thanks and Regards,

Royal Naidu

Hi Royal,


1.As above explain by Gopi you can use below extension in traditional app.

https://www.outsystems.com/forge/component-overview/3163/file-extension-validation-client-side


2.Below code will use for Reactive/Mobile App.

Please check the below example how we can do that 


This gives an error that 'atob' does not exist?