require'rest_client'cookies=nilrequest=RestClient::Request.new(:method=>:post,:url=>'http://www.yoursite.com',:payload=>{:username=>'your account name',:password=>'password'})request.executedo|response,request,result|cookies=response.cookies#save cookies for further useendRestClient.Request.new({:method=>:post,:url=>'http://www.yoursite.com/upload.php',:cookies=>cookies,:payload=>{:multipart=>true,:filepath=>[File.new('a.jpg'),File.new('b.jpg')]}}).executedo|resp,req,result|$stdout.putsrespend