my $enctype = 'form-data/multipart'; $ua = LWP::UserAgent->new; $req = POST $url, Content_Type => $enctype, Content => [ p_progra_idint =>$p_progra_idint, p_upload => [$path_file,$name_file] ]; $res = $ua->request($req); #### $CGI::DISABLE_UPLOADS = 0; $ENV{'TMPDIR'} = $tpath; binmode(STDIN); $req = new CGI(\*STDIN); my $fh = $req->upload('p_upload'); my $buffer; open (OUTFILE, ">$path_sortida") or die "Unable to create upload output file $! \n"; binmode $fh; binmode OUTFILE; my ($bytes, $read); $bytes = 0; while ($read = read ($fh, $buffer, 16384)) { print OUTFILE $buffer; $bytes += $read; } close OUTFILE;