in reply to Am I HTTP posting a file correctly?

Without taking it upon myself to delve into your code ... you should approach solving this problem in this way:

  1. Use a web-data sniffer to observe the actual HTTP transmission that is taking place.
  2. On the server, check for the existence of the file and its actual file-name, which may well be case-sensitive on a Unix/Linux host.   You know exactly what has been sent; you should see exactly the same file-contents there.   Security on the file should be such that the server can reach it.   If you use a utility like md5sum to compare the files on the various computers, the hash-signatures should exactly match.
  3. Examine server logs to see how the server responded to the request to retrieve the file.   The server generally won’t tell you in-detail why it could not “find” the file, but it will tell the log.

Replies are listed 'Best First'.
Re^2: Am I HTTP posting a file correctly?
by mikelupo (Initiate) on Nov 26, 2010 at 19:07 UTC
    Hello,

    Thanks sundialsvc4 for your reply. Unfortunately, I can't get inside the server at hand. I was however able to take your advice about the packet sniffer.

    Note: I can do the method post using java and it works fine, but in not working in perl.
    Using the packet sniffer:
    1) the perl script only posts a few hundred bytes seen in the Content-Length: header vs the Java app which posts about 5K.
    2) I don't see any multipart boundaries posted from perl, yet they are present when posted from java.
    Do I need to "open" the file first and store it locally in memory?

    Please help.

    Regards,
    Mike

      So, likely, no, you are not sending the same data as your Java program.

      The LWP::UserAgent (resp. HTTP::Request) modules (and objects) have methods to print themselves as strings. Use these to find out whether you are initializing them wrongly or whether you are not sending all data.

      Also consider looking at WWW::Mechanize or at least HTML::Form to make form submission easier, at least if you have a HTML form that you're trying to automate.