use strict; use HTTP::Headers; use HTTP::Cookies; use HTTP::Request::Common; use LWP::UserAgent; my $file='testfile.txt'; uploadFileToAmazon($file); sub uploadFileToAmazon{ my $file=shift; my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(autosave => 1 )); $ua->max_redirect(20); push @{ $ua->requests_redirectable }, 'POST'; #First Sign into Amazon SellerCentral account with cookies enabled so they get passed on my $url='https://sellercentral.amazon.com/gp/sign-in/sign-in.html'; my %form=( protocol => "https", action => "sign-in", email => $Username, optin => 1, ouid => "01", password => $Password ); my $res=$ua->post( $url,\%form); #then post the file and pass in the info $url='https://sellercentral.amazon.com/gp/upload-download-utils/upload.html'; my %form=( uploadType => "ShippingConfirmation", uploadFileName =>[$file] ); my $res=$ua->post( $url,'Content-Type' => "multipart/form-data",Content=>\%form); #Display the contents of the response return $res->content; }