-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Multiple files upload with addToBody stores only one file #64
Comments
Definitely, would you like to send a PR? |
Yes I can, probably in couple of days if someone will not make it faster. But I have a question regarding filed type. If we have input with name
or
Also I'm thinking about an idea of changing the default behaviour of this module. I think it would be better if this module will use And if someone will need "streams API" I think it can be done in the same manner. But in field That's just some thoughts, that I think would be nice to have to release version 1.0.0. |
I've made some progress regarding the PR, but I'm stuck in writing tests, because it seems that |
@SkeLLLa In what way does it not support multiple values? Appending to the same field should work. form.append('upload', file1)
form.append('upload', file2) |
@nwoltman I've tried such approach, but in that way I receive only UPD: I've got what was wrong. I've tried to add the same file multiple times, that's why I received only one file in the end. |
I think that it should if we don't want to release a semver-major change. I don't know if this behaviour could be confusing for users, @mcollina WDYT? |
Actually both options could be a bit confusing. If we have, for example one file = object, multiple files = array of objects, then it will need additional |
I’m ok in changing addToBody to set an array of files, it’s a pretty new feature and we won’t break much. I might be ok in making addToBody the default. I’m not convinced in changes to the other API. |
released in v1.0.0 👍 |
Hi. As far as can see from the code and examples if multiple files will be uploaded with singe file input, it will put them into the same field in body and
filename
and other fields inside it will correspond to one of the files.Multiple files could be tracked by number of calls of
defaultConsumer
or if that function is called with different filename. So I think it's better to track it by call number which will represent an index in array. According to this field type in body could be also an array of items withsharedSchemaId
type. And if that array has only one file, then, probably, it could replace array, so we'll get an file object as it's done right now.The text was updated successfully, but these errors were encountered: