Closed twoolworth closed 4 years ago
Hi @twoolworth, thanks for reporting this issue.
Is the upload functionality working for multiple images?
Closing for no response
@nazirov91 I am running into this problem as well, it goes away when I change this to
if(existingFileIds.length === 1){
data[fieldName] = existingFileIds[0];
}else if (existingFileIds.length > 1) {
data[fieldName] = [...existingFileIds];
}
I am not sure that this will play nice in all scenarios tho, maybe you have more insight on this.
I am working on a small example application to get familiar with Strapi and React-Admin and am attempting to upload an image using the ImageInput component. I feel like I've read your documentation at https://github.com/nazirov91/ra-strapi-rest#file-upload and React-Admins at ImageInput at https://marmelab.com/react-admin/Inputs.html.
Right now I only have a single field that allows file upload so my
App.js
has:And is being passed in verbatim as what you've written in the documentation:
For my create screen I also have your code verbatim as:
Inside of my
person.settings.json
the field is referenced as:Whenever I hit save on the form I see the following error logged from the server:
When I inspect the post request I do see it sending an empty array as the field which makes me think that's likely where the error is coming from, the POST request is:
I think this is an issue with how the uploaded files are being mapped to the fields but first wanted to see if you saw anything I had missed. I also wanted to thank you for providing the
ra-strapi-rest
as it did save me a ton of time in getting an example application up and running with React-Admin