#!/usr/bin/perl -- use strict; use warnings; use LWP; my $ua = LWP::UserAgent->new; ## watch "actual" http transactions on stdout $ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return }); $ua->show_progress(1); ## on stderr my $urljig = 'http://jigsaw.w3.org/HTTP/Basic/'; $ua->credentials( URI->new( $urljig )->host_port, 'test', 'guest', 'guest' ); $ua->get( $urljig ); ## first login (get challenged, authenticate) $ua->post( # then upload "big" file $urljig, { # %form file => [ # form input field name undef, # or '/real/path/to/file/to/upload.txt' "filename to be send that is different from real/path/to/file/to/upload", -content_type => 'text/json', -content => "file contents cause undef doesnt read file", ], }, content_type => 'multipart/form-data', # for the %form ); __END__