Now,I have a need that post a file stream,not a local file.the process is:
client(file) ---> my server ----> third party Cloud Storage,the transfer is file stream. I have found this article: Ruby: How to post a file via HTTP as multipart/form-data?
require 'rest_client'
RestClient.post('http://localhost:3000/foo',
:name_of_file_param => File.new('/path/to/file'))
you can see that the name_of_file_param
is a local file,not stream.
so I want to know ,if this is file stream form the client ,what should I do
您应该能够使用任何IO对象(包括流)作为参数:
RestClient.post('http://localhost:3000/foo', :name_of_file_param => my_stream)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.