FileSize

설명

첨부된 파일의 크기(바이트 단위)를 리턴합니다.

이는 읽기 전용 특성입니다. 즉, 볼 수는 있으나 설정할 수는 없습니다. 이 메소드는 첨부가 데이터베이스에 확약된 이후에만 호출할 수 있습니다. 확약 이전에 호출하면 리턴값이 비어 있습니다.

구문

VBScript

attachment.FileSize 

Perl

$attachment->GetFileSize(); 
ID
설명
attachment
파일을 레코드에 첨부함을 나타내는 Attachment 오브젝트.
Return value
파일 크기(바이트 단위)를 나타내는 Long 값.

예제

VBScript

' This example assumes there is at least 1 attachment field 
' and 1 attachment associated with the record. 
set currentSession = GetSession  set attachFields = AttachmentFields 
set attachField1 = attachFields.Item(0) 
set theAttachments = attachField1.Attachments 
For each attachment in theAttachments 
     set thefileName = attachment.FileName 
     set thefileSize = attachment.FileSize 
     currentSession.OutputDebugString "Attached file: " & _
          thefileName & " - size: " & thefileSize 
Next

Perl

# This example assumes that there is at least 1 attachment
# field associated with the record. Otherwise, 
# GetAttachmentFields won't return anything interesting
#  and an error would be generated

# Get the collection of attachment fields
$attachfields = $entity->GetAttachmentFields();

# Get the first attachment fields
$attachfield1 = $attachfields->Item(0)

# Now get the collection of attachments from the attachments field
$attachments = $attachfield1->GetAttachments();

# Retrieve the number of attachments for the for loop
$numattachments = $attachments->Count();

for ($x = 0 ; $x < $numattachments ; $x++)
 {
 # Retrieve the correct attachment
 $attachment = $attachments->Item($x);

 # Get the filename and filesize for the attachment and print out
 # the results
 $filename = $attachment->GetFileName(); 
 $filesize = $attachment->GetFileSize();
 $session->OutputDebugString("Attached file: ".$filename." -
           size: ".$filesize);
 } 

피드백