express-fileupload icon indicating copy to clipboard operation
express-fileupload copied to clipboard

Does the file upload work for react native apps ?

Open varshith5c opened this issue 2 years ago • 2 comments
trafficstars

I have setup all the configuration correctly. When I hit the API using web browser I am able to upload the file . ie I am able to get req.files but when I send it from mobile eventhough the header is multipart/form-data I am not able to get any data in req.files. I always get null as a value

varshith5c avatar Jun 20 '23 16:06 varshith5c

Hi.

What exact header you had? Any examples, snippet, configuration details?

RomanBurunkov avatar Sep 26 '23 14:09 RomanBurunkov

You need to install form-data and then use the code below to add the file to the request payload. Just setting the header wont do anything

const formData = new FormData()
formData.append("file", { uri: file.path, name: file.fileName, type: file.type })

king-d-dev avatar Nov 21 '23 13:11 king-d-dev

No answers from the issue author

RomanBurunkov avatar Jun 26 '24 09:06 RomanBurunkov