Could anyone please give a working example of how to upload a file using Delphi CGI.
I have googled but so far haven't had any luck.
This is what I have been trying but I am getting access violations.
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
lFileName : string;
lFileStream : TFileStream;
begin
lFileName := Request.Files[0].FileName;
lFileStream := TFileStream.Create(lFileName, fmCreate);
try
lFileStream.CopyFrom(Request.Files[0].Stream, Request.Files[0].Stream.Size);
finally
lFileStream.Free;
end;
end;