mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 17:49:25 +02:00
* Reworked TUploadedFile.Stream
git-svn-id: trunk@26572 -
This commit is contained in:
parent
be85998313
commit
e164a16171
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user