Re: [twsocket] Http file upload

2007-03-17 Thread Francois PIETTE
>>> What is the best place to start and stop timing ?
>>> OnHeaderRequestEnd ?
>>
>> OnRequestDone.
>
> onRequestdone to stop the timing,
> but when start the timing?

When you call Post if you want to take connection time in the count, or 
OnSessionConnected if you want to start when the server is connected. Pay 
attention to persistant connections !

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Http file upload

2007-03-17 Thread Paul
I've tested with an example i found in the archives.

'Method not allowed' is returned.

What am I doing wrong ?

Paul




function TBandwidthCheckForm.Upload:boolean;
const
  LR= #13#10;
var
  Buf : String;
  FileToSend : TMemoryStream;
  Boundary, FName: string;
begin
  result:= true;
  FName:= '20k.jpg';
  TestClient.URL:= UrlBandWidhUpload;
  try
with TestClient do begin
  Boundary := '-7cf29e12c04';
  ContentTypePost := 'multipart/form-data; boundary=' + 
copy(Boundary,3,length(Boundary));

  Buf := Boundary + LR + 'Content-Disposition: form-data; name="upfile"; 
filename="' + FName + '"'
  + LR + 'Content-Type: image/jpeg' + LR + LR;

  SendStream:= TMemoryStream.Create;
  try
SendStream.Write(Buf[1], Length(Buf));
FileToSend := TMemoryStream.Create;
FileToSend.LoadFromFile(TestFile);
FileToSend.SaveToStream(SendStream);
FileToSend.Free;

Buf := ConCat(buf,Boundary+'--');
SendStream.Write(Buf[1], Length(Buf));
SendStream.Seek(0, soFromBeginning);
FFileSize:= SendStream.Size;
SetThreadPriority(Application.Handle, 
THREAD_PRIORITY_TIME_CRITICAL);
Post;
ElapsedTimeMs:= CalcMilliSeconds(StartTime);
SetThreadPriority(Application.Handle, THREAD_PRIORITY_NORMAL );
  finally
TestClient.RcvdStream.Free;
TestClient.RcvdStream := nil;
TestClient.SendStream.Free;
TestClient.SendStream := nil;
  end;
end;
  except;
result:= false;
  exit;
  end;
end;

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Http file upload

2007-03-17 Thread Paul
Thanks


Paul


- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Saturday, March 17, 2007 2:29 PM
Subject: Re: [twsocket] Http file upload


> Francois PIETTE wrote:
>>> where can I find an example for uploading a file to a webserver using
>>> httpCli ?
>> 
>> That is no different than posting anything else. Pay attention to the
>> data format. Most scripts expect MIME multi-part format. 
> 
> New TMultiPartFileReader from IcsSteams.pas may be helpfull creating
> the stream.
> 
> --
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
> 
> 
> 
>> You'll find
>> sample by searching the mailing list archive.
>> 
>>> I also want to measure the time needed to upload the file.
>>> What is the best place to start and stop timing ?
>>> OnHeaderRequestEnd ?
>> 
>> OnRequestDone.
>> 
>> --
>> Contribute to the SSL Effort. Visit
>> http://www.overbyte.be/eng/ssl.html --
>> [EMAIL PROTECTED]
>> http://www.overbyte.be
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
> 
>
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Http file upload

2007-03-17 Thread Paul
thanks,

>> What is the best place to start and stop timing ?
>> OnHeaderRequestEnd ?
>
> OnRequestDone.

onRequestdone to stop the timing,
but when start the timing?

Paul



- Original Message - 
From: "Francois PIETTE" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Saturday, March 17, 2007 2:04 PM
Subject: Re: [twsocket] Http file upload


>> where can I find an example for uploading a file to a webserver using
>> httpCli ?
>
> That is no different than posting anything else. Pay attention to the data
> format. Most scripts expect MIME multi-part format. You'll find sample by
> searching the mailing list archive.
>
>> I also want to measure the time needed to upload the file.
>> What is the best place to start and stop timing ?
>> OnHeaderRequestEnd ?
>
> OnRequestDone.
>
> --
> Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
> --
> [EMAIL PROTECTED]
> http://www.overbyte.be
>
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
> 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Http file upload

2007-03-17 Thread Arno Garrels
Francois PIETTE wrote:
>> where can I find an example for uploading a file to a webserver using
>> httpCli ?
> 
> That is no different than posting anything else. Pay attention to the
> data format. Most scripts expect MIME multi-part format. 

New TMultiPartFileReader from IcsSteams.pas may be helpfull creating
the stream.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

 

> You'll find
> sample by searching the mailing list archive.
> 
>> I also want to measure the time needed to upload the file.
>> What is the best place to start and stop timing ?
>> OnHeaderRequestEnd ?
> 
> OnRequestDone.
> 
> --
> Contribute to the SSL Effort. Visit
> http://www.overbyte.be/eng/ssl.html --
> [EMAIL PROTECTED]
> http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Http file upload

2007-03-17 Thread Francois PIETTE
> where can I find an example for uploading a file to a webserver using 
> httpCli ?

That is no different than posting anything else. Pay attention to the data 
format. Most scripts expect MIME multi-part format. You'll find sample by 
searching the mailing list archive.

> I also want to measure the time needed to upload the file.
> What is the best place to start and stop timing ?
> OnHeaderRequestEnd ?

OnRequestDone.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Http file upload

2007-03-17 Thread Paul
where can I find an example for uploading a file to a webserver using httpCli ?
I also want to measure the time needed to upload the file.
What is the best place to start and stop timing ?
OnHeaderRequestEnd ?

Paul
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] HTTP File upload examples

2005-06-23 Thread Tom York

Does anyone have experience with the file uploading using the HTTPServer?  I
have a working server, but cannot seem to get the PostedData event handler
working properly (mime parsing).  Is there classes/functions that I can make
use of in mimeutil.pas?

Thanks.


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be