Find the length of FileContent

Find the length of FileContent

  

Hi All,


 How to find the length of uploaded file content (Web App). I want to restrict the file size upto 12KB. 

Are there any built in function that I can use to get the number of bytes of the file content.



Hi shanmuk,

You need to reference the BinaryData extension's BinaryDataSize function. It returns the size in bytes of a variable of type Binary. If you pass UploadWidget.Content (where UploadWidget is the name of your upload widget), you'll get the number of bytes.

Hi Kilian,


Thanks for reply. I am newbie to this outsytems. Can you brief what is "referencing the BinaryData extension's BinaryDataSize function" mean?



Solution

Hi shanmuk,

"Referencing" means to add a dependency to an eSpace.

  1. Click the Manage Dependencies... button on the top toolbar
  2. In the Manage Depencies pop-up, select the BinaryData module (left pane), and click the BinaryDataSize action (right pane):
  3. Clik "Ok".
  4. Now you can use the BinaryDataSize action. Since it is also a function, you can directly use it in an expression.


Solution

Kilian Hekhuis wrote:

Hi shanmuk,

"Referencing" means to add a dependency to an eSpace.

  1. Click the Manage Dependencies... button on the top toolbar
  2. In the Manage Depencies pop-up, select the BinaryData module (left pane), and click the BinaryDataSize action (right pane):
  3. Clik "Ok".
  4. Now you can use the BinaryDataSize action. Since it is also a function, you can directly use it in an expression.


Hi Kilian Hekhuis,


 Its working. You made my day :)


Hi shanmuk,

Great to hear it's working! Please mark my answer as the Solution, so this thread is marked as Solved. Thanks!