SoFunction
Updated on 2025-03-04

Ruby using restclient to upload server local files example


url = 'http://xx' #post to url
field_hash = {key: key, token: token}  #post data
request = url, field_hash.merge(file: (('public', "#{params[:logo]}"), 'rb')) #Upload file

reponse = request.to_s #Return result