cancel
Showing results for 
Search instead for 
Did you mean: 
WarrenBelz

Show size of attachment or uploaded file

Have you ever wanted to show or use the size of an uploaded file - the process is below

ImageSize.pngAttachSize.png

Attachment

Firstly, you need a hidden image control with the Image

Last(AttachmentControlName.Attachments).Value

Then on the OnAddFile (and OnRemoveFile if you want)

UpdateContext(
   {
      varJSON: 
      JSON(
         YourHiddenImageName.Image,
         JSONFormat.IncludeBinaryData
      )
   }
)

Then the Label below has the Text

"Last Attachment: " & (Len(varJSON) - 814) / 1370000 & " Mb"

and that is the extent of it.

 

Uploaded File

A similar, but less complex process - on the OnChange of the AddMediaButton

UpdateContext(
    {
      varJSON: 
      JSON(
         UploadedImageName.Image,
         JSONFormat.IncludeBinaryData
      )
   }
)

and the Label below

"Image Size: " & (Len(varJSON) - 814) / 1370000 & " Mb"