FileName

설명

첨부 파일의 경로 이름을 리턴합니다.

이는 읽기 전용 특성입니다. 즉, 볼 수는 있으나 설정할 수는 없습니다.

데이터베이스에 대해 첨부를 확약하기 전에는 이 특성에 파일의 원래 경로 이름이 들어 있습니다. 그러나, 첨부를 확약한 후에는 파일이 파일 시스템이 아닌 데이터베이스에 존재하므로 경로 정보가 제거됩니다. 예를 들어, C:\projectsmyfilesexample.txt 파일을 추가할 경우 레코드가 확약될 때까지 전체 이름을 보유하며, 확약 이후 이름이 example.txt로 축소됩니다.

Rational® ClearQuest®에서는 이름이 같고 경로가 다른 두 파일을 같은 데이터베이스에 첨부할 수 있습니다. Rational ClearQuest는 내부의 파일을 찾을 때 파일 이름 외에 다른 정보도 구분합니다. 또한 50자 이내의 파일 이름 길이 제한사항도 있습니다.

구문

VBScript

attachment.FileName 

Perl

$attachment->GetFileName(); 
ID
설명
attachment
파일을 레코드에 첨부함을 나타내는 Attachment 오브젝트.
Return value
참부 파일의 이름을 포함하는 문자열.

예제

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);
 } 

피드백