I think something has changed here. formData.append(name, x) expects a string here so fs.createReadStream(filePath) is toString()'ed to "[object Object]" and that is what the body of the request is.
There are some differences between native FormData and node-fetchFormData` and I think there might be some confusion here.
I have removed the streaming component part and replaced it with what was on the node-fetch website for handling file uploads using the File object. Now it works and I can see my pictures in the app.
When I was trying to get it to work last time there was also an issue with the file path not being found. I think that was something to do with streams not really knowing where they are from. Anyway, it only worked before if I didn't add a path to the file e.g. '1-jack.jpg' worked but '/path/to/1-jack.jpg' did not work. That appears to be fixed too (with this implementation).
In pushes.js#70 you have:
I think something has changed here.
formData.append(name, x)
expects a string here sofs.createReadStream(filePath)
istoString()
'ed to "[object Object]" and that is what the body of the request is.There are some differences between native
FormData
andnode-fetch
FormData` and I think there might be some confusion here.I have removed the streaming component part and replaced it with what was on the node-fetch website for handling file uploads using the
File
object. Now it works and I can see my pictures in the app.When I was trying to get it to work last time there was also an issue with the file path not being found. I think that was something to do with streams not really knowing where they are from. Anyway, it only worked before if I didn't add a path to the file e.g. '1-jack.jpg' worked but '/path/to/1-jack.jpg' did not work. That appears to be fixed too (with this implementation).
Related to #49