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
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"
*This post is locked for comments