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.

In reply to how to upload file on server using POST and login/passwork/cookies? by igrock

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.