Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jan : TidHttpServer - uploading file fom web browser
| Subject: | TidHttpServer - uploading file fom web browser |
| Posted by: | "Joe Aley" (joealey20..@yahoo.com) |
| Date: | Sun, 15 Jan 2006 02:52:42 |
Hi all...
I could receive a file from a web browser but it's not exactly the same
i send. Seems there was an encode.
Here goes the form i used:
<form enctype="multipart/form-data" action="upload" method="post">
<input type="file" name="upfile">
<input type="submit" value="Send">
</form>
now goes the OnCommandGet() code:
//-----------
TheFile:=TMemoryStream.Create;
TheFile.LoadFromStream(ARequestInfo.PostStream);
TheFile.SaveToFile('uploaded.dat');
//-----------
Another thing i did was add this line in ServerCreatePostStream event
//-----------
procedure TForm1.ServerCreatePostStream(ASender: TIdPeerThread;
var VPostStream: TStream);
begin
VPostStream:=TMemoryStream.Create;
end;
//------------
Now, what do i have to do to decode it?