Erik A wrote:

> 
> I normally use a html form to manually upload zip files to a web server. 
> A perl script on the server takes care of the form/files submitted.
> 
> I now would like to upload the files automatically from a perl script 
> instead. Hence I would like to send my files from a perl http client for 
> acceptance by the perl script on the server.
> 
> Can someone please guide me on this or point me to info on some web 
> page? I already have a perl http client which handles GET/POST ok. But I 
> am lost on what headers to specify etc in order to make the two perl 
> scripts communicate and the files to be sent.


Easiest thing to do is dump the data that is sent by the client browser
on an upload.  Then try to duplicate it either with sockets or LWP.  I
think LWP should be able to replicate it close enough.  If I get a chance,
I'll try to make a snippet.

This is what the data stream looks like from Netscape for a jpg (<comments>
are mine and the data is truncate in the middle):

POST /cgi-bin/upload.pl HTTP/1.0
Connection: Keep-Alive
User-Agent: Mozilla/4.72 [en] (Win98; U)
Host: localhost2:81
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en,en-GB
Accept-Charset: iso-8859-1,*,utf-8
Content-type: multipart/form-data; boundary=---------------------------15194274615570
Content-Length: 4910
                                        <blank line then start of body>:
-----------------------------15194274615570
Content-Disposition: form-data; name="ACTUAL"           <1st form arg name>

sample.jpg 
                                        <1st form arg value>
-----------------------------15194274615570
Content-Disposition: form-data; name="FILE"; filename="C:\Tmp\ddprev.jpg"
Content-Type: image/jpeg

ÿØÿàJFIF 
                                <truncated data sample>
...
Ûþ=ÿ¯ÿÙ
-----------------------------15194274615570--

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

MSIE version of above:

POST /cgi-bin/upload.pl HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---------------------------7d00385b4
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Host: localhost2:81
Content-Length: 4897
Connection: Keep-Alive
                                        <blank line then start of body>:
-----------------------------7d00385b4
Content-Disposition: form-data; name="ACTUAL"           <1st form arg name>

sample.jpg 
                                        <1st form arg value>
-----------------------------7d00385b4
Content-Disposition: form-data; name="FILE"; filename="C:\Tmp\ddprev.jpg"
Content-Type: image/pjpeg

ÿØÿàJFIF 
                                        <truncated data sample>
...
¯ÿÙ
-----------------------------7d00385b4--


-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to