Perhaps one of the hardest things to do, and that is to figure out how to upload an image to strapi,
and to link it to a specific content type.
On...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks Bassel it's really helpful. Just to add a little, for strapi v4 in url you must include
/api
endpoint, suchhttp://localhost:1337/api/upload
. Otherwise it will throw an error.Thanks a lot for this article men, this issue almost makes me crazy😅
Hi, do you believe the same process in react native will work?
The process concerning Strapi yes, However React Native probably uses a different way to get the files from a mobile phone.
where strapi saves the photos? to the folder that can be committed to git?
Yes Strapi does save photos by default to a folder that can be committed with git, however I recommend you use a cloud storage provider, the same method will work. You just need to setup the storage provider with Strapi
Hi Bassel after doing this giving response 400 (Bad Request) opening the network tab and i see no data sent just nulll do you know where the problem may locate
Hello Amr, I am with the same problem (Bad Request). But if I use just /upload, without the api, I then get an Unauthorized.
Did you solve this?
Hi Mauricio, yes i solved this problem by using axios like this
and don't forget to check upload permission in strapi users panel for public if you want to upload with authenticated users send token in the headers with the post request.
Hello yes the new version of Strapi, the V4 version needs to be
api/upload
I will try to update the post to follow the new version
Thanks @bassel17 ...! but i want to help in add image with caption is it possible in strapi v4 ?