12
Views
2
Comments
Solved
Is there a way to check binary file size in a client action in react?
Question

Is there a way to check binary data file size (from the upload widget) on client side vs sending the whole binary to a server action to check it?

Rank: #472
Solution

Given an Upload widget named "FileUpload":


You can use the following JavaScript snippet to extract file size information in Bytes:

var fileInputElem = document.getElementById($parameters.FileUploadId);
$parameters.FileSizeBytes = fileInputElem.files[0].size;


Passing the Widgets.FileUpload.Id as parameter to the JS Snippet:



The above works and I found that the binary data actions react forge component also just (or since I last updated it) updated to include a react client side file size action.