@AttachmentLengths (JavaScript)

Returns the lengths in bytes of the files attached to the current document.

Defined in

@Functions (JavaScript)

Syntax

@AttachmentLengths() : any
Return value Description
any An array of integers containing the file lengths, or an empty string if the current document has no attachments.

Examples

This example is the value for a computed field. It returns the number of attachments in the current document, plus the names, lengths, and modification times of the attachments.
var s = "Attachments (" + @Attachments() + "):\n";
for(var i = 0; i < @Attachments(); i++) {
	s = s +
	@AttachmentNames()[i] + " (" +
	@AttachmentLengths()[i] + " bytes) " + 
	@AttachmentModifiedTimes()[i] + "\n";
}
return s;