#!/perl use Mojo::UserAgent; use Data::Dumper; use Mojo::UserAgent::CookieJar; my $ua = Mojo::UserAgent->new(); my $browser='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.2.2000 Chrome/30.0.1599.101 Safari/537.36';
$ua->transactor->name($browser); my $cookie_jar = $ua->cookie_jar; $ua = $ua->cookie_jar(Mojo::UserAgent::CookieJar->new);
my $posturl="http://20xxxx9/upload_insert.php";
my @files=glob"DRN*"; printjoin"\n",@files;
foreachmy $file(@files) { my $title=$file; my $filename=$file; upload_file($title,$filename);
}
subupload_file { my ($title,$filename)=@_; my $tx=$ua->post($posturl=>{Content_Type =>'form-data'}=>form=>{ task_title=>$title, task_uploaded_file=>{file=>$filename}