igrock has asked for the wisdom of the Perl Monks concerning the following question:

Hi all. There is an "Shockwave Flash" plugin for uploading files on server, but its not mutch convenient, and quiet slow, thats why I want to write script on perl in order to upload files. it has 3 buttons: 1: "Get file" 2: "Reset" 3: "Upload" in order they to appear on main page I have login. The use of this plugin is simple, I have to push "Get file" button to get some file from harddrive, then I have to push "Upload" to upload this file, thats all. But there is some problem: I have cought some packets, being uploaded "file.txt". Those are packets analized by wireshark:
POST /script.php?sid= HTTP/1.1^M Host: Host:8080^M Accept-Encoding: deflate, gzip^M User-Agent: Shockwave Flash^M Connection: Keep-Alive^M Cache-Control: no-cache^M Accept: text/*^M Content-Length: 423^M Content-Type: multipart/form-data; boundary=-------------------------- +-- a37b7eb94a71^M ^M ------------------------------a37b7eb94a71^M Content-Disposition: form-data; name="Filename"^M ^M test.txt^M ------------------------------a37b7eb94a71^M Content-Disposition: form-data; name="Filedata"; filename="file.txt"^M Content-Type: application/octet-stream^M ^M 123qwe ^M ------------------------------a37b7eb94a71^M Content-Disposition: form-data; name="Upload"^M ^M Submit Query^M ------------------------------a37b7eb94a71--^M HTTP/1.1 200 OK^M Date: Tue, 11 Jan 2011 12:18:49 GMT^M Server: Apache^M X-Powered-By: PHP/5.2^M Content-Length: 107^M Keep-Alive: timeout=15, max=100^M Connection: Keep-Alive^M Content-Type: text/html; charset=windows-1251^M ^M <strong>........ ...... .............. ................!</strong> <a h +ref="file/file">................</a>
This is an entire session dumped after pushing the button "Upload", but I cant see there any login/password or cookies. Can anybody write a little draft on this script, just to guid me for HTTP-perl programming. I know there is a tool LWP, but the ecsact problems for me is I dont know where I have to put login/password, and when and how I can caught cookies for my login/password. May be this question is more about HTTP programming rather than perl, but at least its about LWP thats a perl liblrary. Thanks.
  • Comment on how to upload file on server using POST and login/passwork/cookies?
  • Download Code

Replies are listed 'Best First'.
Re: how to upload file on server using POST and login/passwork/cookies?
by Anonymous Monk on Jan 12, 2011 at 03:34 UTC
    No thanks, do some searching, find the demos and examples, copy, paste, modify