FileName

Descripción

Devuelve el nombre de vía de acceso del archivo adjunto.

Es una propiedad de sólo lectura; se puede visualizar, pero no se puede establecer.

Antes de confirmar el archivo de datos adjuntos en la base de datos, esta propiedad contiene el nombre de la vía de acceso original del archivo. Sin embargo, después de confirmar el archivo de datos adjuntos, el archivo existe en la base de datos en vez de en el sistema de archivos, por lo que se elimina la información de la vía de acceso. Por ejemplo, si se añade el archivo C:\projectsmyfilesexample.txt, tendrá este nombre completo hasta que se confirme el registro, después de lo cual el nombre se abrevia, y pasa a ser example.txt.

En Rational ClearQuest se permite adjuntar dos archivos con el mismo nombre e información de vía de acceso diferente a la misma base de datos. Rational ClearQuest no depende sólo del nombre de archivo al localizar el archivo internamente. Asimismo, existe una limitación de la longitud del nombre de archivo de 50 caracteres.

Sintaxis

VBScript

attachment.FileName 

Perl

$attachment->GetFileName(); 
Identificador
Descripción
attachment
Un objeto Attachment que representa el archivo de datos adjuntos de un archivo en un registro.
Valor de retorno
Un valor String que contiene el nombre del archivo adjunto.

Ejemplo

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

Feedback