-
Notifications
You must be signed in to change notification settings - Fork 976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to upload multiple images as form-data with same key #1157
Comments
@gersanco couple of questions from me:
|
One file
I received:
When I try to upload 2 files:
And I received:
|
Thanks @gersanco, I believe the issue might be here:
The server expects |
Ah, I forgot about the good old Something like this:
If this still doesn't work, please share the logs again |
Hi @iMacTia
|
Maybe it helps you if I send you how I make the request request.url(session.api_url + path)
request.headers['Authorization'] = "Bearer #{ session.access_token }" unless session.access_token.nil?
# I had this before your last comment
# request.options[:params_encoder] = Faraday::FlatParamsEncoder
request.params = params.to_h.camelize_keys
upload_files = files.map{ |file| Faraday::FilePart.new(file, 'image/png') }
request.body = { image: upload_files } |
@gersanco I've spent some time on this over the week but with no luck. |
It's coming from here: faraday/lib/faraday/request/multipart.rb Lines 80 to 82 in d77c9ef
Here's what happens:
@iMacTia The param encoders have a single |
@technoweenie thanks for pointing me in the right direction! That makes sense, so there's a bit of duplication between the params encoders and the multipart middleware 🤔. |
Hello, |
@gersanco Absolutely! I managed to reproduce this issue in a test already and I’m now looking for a way to make this work based on the suggestion above 👍 |
@iMacTia Perfect, thanks so much 😃 |
Basic Info
Issue description
Hello, I'm developing an app and I need to upload multiples images as form-data with the same name. (https://developer.epages.com/beyond-docs/#upload_multiple_product_images)
This the curl call that I need to implement:
How can I transcribe it to faraday?
I followed this issue #830 but I've been able to upload 1 file only if I try to upload multiples doesn't work.
Steps to reproduce
This is what I have:
The text was updated successfully, but these errors were encountered: