使用RestClient上传服务器本地文件 代码如下:url = ‘http://xx’ #post到urlfield_hash = {key: key, token: token} #post数据request = RestClient.post url, field_hash.merge(file: File.new(File.join(‘public’, “#{params[:logo]}”), ‘rb’)) #上传文件reponse = request.to_s #返回结果