my $browser = LWP::UserAgent->new; $picture = 'fun.jpg'; $browser->default_header('X-Requested-With' => "XMLHttpRequest"); $browser->default_header('X-File-Name' => $picture); my %args; my $field_name = ""; my $buf ; my $buf_ref = $args{'buf'} || \$buf ; my $value = read_file( $picture , binmode => ':raw' , scalar_ref => 1 ); my $response = $self->browser->post( "http://host.com/upload/profilepic/?qqfile=".$picture, Content_Type => 'application/octet-stream', Content => $value ); print $response->content;