- url = 'http://xx' #post到url
- field_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 #返回结果
- #该片段来自于http://www.codesnippet.cn/detail/220720134734.html
来源: http://www.codesnippet.cn/detail/220720134734.html