I'm using react-dropzone to upload multiple files to a Sails.js server. Since react-dropzone gives me the list of dropped files, I'm appending them to a FormData object. With this, when the request hits the server, the req.file('myfile').upload() won't work, since I don't have any input[type=file] on the page and I'm working with AJAX. My question is: Does Skipper have any method to handle FormData uploads or I need to use Multer or something like that?
Add a comment
|
1 Answer
Well... in the end, I was using FormData the wrong way. If anyone out there aren't seeing the files array in the server, just make sure to not use brackets in the key you append to FormData.
// Incorrect
formdata.append('files[]', file)
// Correct
formdata.append('files', file)
2 Comments
Noitidart
Ya apparently arrays are not supported in formdata for salis. Is this an express thing? I have an array of ids i want to send i tried
formdata.append('foo[]', 12); formdata.append('foo[]', 23); but nothing. did you figure this out ever?Noitidart
also formdata cant submit null
formdata.append('description', null) it makes null a string.