filestorage Files property
Example
Return to Introduction  Previous page  Next page
Applies to
acFileStorage component.  

Declaration
property Files: TStoredFiles; { Successor of TList. Contains the list of TStoredFile objects }  

Description
The Files property is the List, which contains all currently stored files. Every item of this list is the file uploaded onto your form at design-time. All files in this list are TStoredFile objects.  
 
If you would like to access stored file at run-time directly from memory you may use following example:  
 
var  
  StoredFile: TStoredFile;  
  DataStream: TMemoryStream;  
begin  
  StoredFile := FileStorage1.Files[1];  
  DataStream := StoredFile.Data; // Data: TMemoryStream  

tip Another example (demonstrates how to retrieve the content of text file to Memo control):
begin  
  TStoredFile(acFileStorage1.Files[0]).Data.Position := 1; // Since Data is the stream we must reset its position  
  Memo1.Lines.LoadFromStream(TStoredFile(acFileStorage1.Files[0]).Data);  
end;  

See also
Count and DataSize properties;  
Extract method.