richardgirges / express-fileupload

Simple express file upload middleware that wraps around busboy
MIT License
1.52k stars 259 forks source link

Does the file upload work for react native apps ? #350

Closed varshith5c closed 2 weeks ago

varshith5c commented 1 year ago

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

RomanBurunkov commented 9 months ago

Hi.

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

king-d-dev commented 7 months ago

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 })
RomanBurunkov commented 2 weeks ago

No answers from the issue author