Closed tomciopp closed 5 years ago
Sorry for the late answer. But you can stream a multipart using the stream api with a combination of hackney:send_multipart_body/2 and hackney:stream_multipart/1
Hope it helps.
@benoitc Thanks for the help! I was able to get everything to work after some finagling.
I need to upload a file that is stored in S3 to another service via an API call. I don't have the ability to write to a temporary file and pass in its path because the server has a read only file system. I can get the contents of the file, the content type and a filename but just can't create an actual file. Based on what I have I don't believe I can upload a file using
hackney_multipart:encode_form/1
as currently written since it doesn't support this option.After reading the source, I think it would be possible to add something like a
filecontent
option to match against where you could pass in all the options and just skip the reading of the file from a path. If you think this is a reasonable feature to add, I can give a crack at updating the code to support it.If there is actually a way to do this via existing functions, I obviously would prefer that. However, I'm unsure if this can be done without making changes.