0
當運行下面的代碼發佈上傳我的參數文件,我得到下面的錯誤消息。我無法弄清楚這一點,不勝感激。Rest客戶端發佈錯誤
錯誤:
uploadhttp.rb:11:in `size': No such file or directory @ rb_file_s_size - hfs.exe (Errno::ENOENT) from uploadhttp.rb:11:in `<main>'
代碼:
begin
RestClient::Request.execute(:method => :post, :url =>
'http://my external ip:8080/upload/', :timeout => 30, :open_timeout => 30,
:name_of_file_param => File.new("C:\\Users\\Michael\\Downloads\\#{nfile}"))
filesize=(File.size("#{nfile}"))
result=(filesize.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse)
print "#{result} bytes were uploaded to Mikez http file Server"
rescue RestClient::ExceptionWithResponse => err
puts "an error has occured potential timeout"
end