* Reworked TUploadedFile.Stream

git-svn-id: trunk@26572 -
This commit is contained in:
michael 2014-01-24 09:44:36 +00:00
parent be85998313
commit e164a16171

View File

@ -153,6 +153,7 @@ type
// Note that this will free the file stream, to be able to close it - file is share deny write locked! // Note that this will free the file stream, to be able to close it - file is share deny write locked!
Procedure DeleteTempUploadedFile; virtual; Procedure DeleteTempUploadedFile; virtual;
function GetStream: TStream; virtual; function GetStream: TStream; virtual;
Procedure FreeStream; virtual;
Public Public
Destructor Destroy; override; Destructor Destroy; override;
Property FieldName : String Read FFieldName Write FFieldName; Property FieldName : String Read FFieldName Write FFieldName;
@ -1727,13 +1728,15 @@ Var
s: String; s: String;
begin begin
if Assigned(FStream) and (FStream is TFileStream) then if (FStream is TFileStream) then
FreeAndNil(FStream); FreeStream;
if (LocalFileName<>'') and FileExists(LocalFileName) then if (LocalFileName<>'') and FileExists(LocalFileName) then
DeleteFile(LocalFileName); DeleteFile(LocalFileName);
end; end;
function TUploadedFile.GetStream: TStream; function TUploadedFile.GetStream: TStream;
begin begin
If (FStream=Nil) then If (FStream=Nil) then
begin begin
@ -1744,9 +1747,15 @@ begin
Result:=FStream; Result:=FStream;
end; end;
destructor TUploadedFile.Destroy; Procedure TUploadedFile.FreeStream;
begin begin
FreeAndNil(FStream); FreeAndNil(FStream);
end;
destructor TUploadedFile.Destroy;
begin
FreeStream;
Inherited; Inherited;
end; end;