<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2>I've used the Indy library that comes with Delphi to do
HTTP uploads with progress notification. Works quite
well.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2>E.g.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2> FHTTPClient := TIdHTTP.Create(nil);<BR> with
FHTTPClient do begin<BR> ProxyParams.ProxyServer:=
ProxyHost;<BR> ProxyParams.ProxyPort :=
ProxyPort;<BR> ProxyParams.ProxyUsername :=
ProxyUsername;<BR> ProxyParams.ProxyPassword :=
ProxyPassword;<BR> OnWork :=
HTTPWorkEvent;<BR> OnWorkBegin :=
HTTPBeginWorkEvent;<BR> OnWorkEnd :=
HTTPEndWorkEvent;<BR> end;<BR></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2>I use it to upload a JPEG to a webserver running Gallery
(<A href="http://gallery.menalto.com/">http://gallery.menalto.com/</A>) as
follows:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2>function TGalleryHelper.AddImage(const AlbumID: Integer;
const Image: TStream; const ImageFilename, Caption, Description, Summary:
String): TGalleryStatus;<BR>var<BR> Command: String;<BR> Response:
String;<BR> ImageStream:
TIdMultipartFormDataStream;<BR>begin</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2> ...<BR>
ImageStream := TIdMultiPartFormDataStream.Create;<BR>
try<BR></FONT></SPAN><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2>
ImageStream.AddFormField('g2_form[cmd]',
'add-item');<BR>
ImageStream.AddFormField('g2_form[protocol_version]', Format('%f',
[PROTOCOL_VERSION]));<BR>
ImageStream.AddFormField('g2_form[set_albumId]', Format('%d',
[AlbumID]));<BR>
ImageStream.AddFormField('g2_form[caption]',
Caption);<BR>
ImageStream.AddFormField('g2_form[force_filename]',
ImageFilename);<BR>
ImageStream.AddFormField('g2_form[extrafield.Summary]',
Summary);<BR>
ImageStream.AddFormField('g2_form[extrafield.Description]',
Description);<BR>
ImageStream.AddObject('g2_userfile', 'image/jpeg', Image,
ImageFilename);</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff size=2> Response :=
FHTTPClient.Post(Command, ImageStream);<BR>
finally<BR>
ImageStream.Free;<BR> end;<BR>
...</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV></SPAN><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2>The events that the TIdHTTPClient class raises can be handled as
follows:</FONT></SPAN></DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2>procedure TGalleryHelper.HTTPBeginWorkEvent(Sender: TObject; AWorkMode:
TWorkMode; const AWorkCountMax: Integer);<BR>begin</FONT></SPAN></DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2> // Do something with AWorkCountMax, e.g. set
the max value on a progress bar.<BR>end;</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2>procedure TGalleryHelper.HTTPEndWorkEvent(Sender: TObject; AWorkMode:
TWorkMode);<BR>begin</FONT></SPAN></DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2> // You're all done.<BR>end;</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2>procedure TGalleryHelper.HTTPWorkEvent(Sender: TObject; AWorkMode:
TWorkMode; const AWorkCount: Integer);<BR>begin</FONT></SPAN></DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2> // Do something with AWorkCount, e.g.
set the progress value of a progress bar.<BR>end;</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff size=2>I have
all this running in a thread to keep my GUI nice and responsive while the upload
is happening.</FONT></SPAN></DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff size=2>HTH,
if you've more questions, let me know.</FONT></SPAN></DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=298055419-15092008><FONT face=Arial color=#0000ff
size=2>Conor</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT size=2><FONT
face=Tahoma><B>From:</B> delphi-bounces@delphi.org.nz
[mailto:delphi-bounces@delphi.org.nz] <B>On Behalf Of </B>Jeremy
Coulter<BR><SPAN class=298055419-15092008><FONT face=Arial
color=#0000ff> </FONT></SPAN></FONT></FONT></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT size=2><SPAN
class=156381010-15092008><FONT face=Arial>I am wondering if anyone has seen or
has any Delphi code that will do an http file upload, BUT that shows you the
upload progress.</FONT></SPAN></FONT></DIV>
<DIV><SPAN class=156381010-15092008><FONT face=Arial size=2>I have looked at the
Synapse code for doing this, but it doesn't have the ability to show the
progress.</FONT></SPAN></DIV>
<DIV><SPAN class=156381010-15092008><FONT face=Arial size=2>Why use HTTP File
upload and not FTP? simple answer, not every site has FTP enabled...as we have
found out, and email has been a bit unreliable.</FONT></SPAN></DIV>
<DIV><SPAN class=156381010-15092008><FONT face=Arial size=2>I have taken a look
at the odd Java plugin that does this which would be good because I could just
have my app. look at a webpage instead of build it into the exe, but then, no
guarantees that java is enabled either....sigh...the joys
:-(</FONT></SPAN></DIV>
<DIV><SPAN class=156381010-15092008><FONT face=Arial size=2>OR someone might
even have a brighter idea ;-)</FONT></SPAN></DIV></BODY></HTML>