1

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?

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

2 Comments

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?
also formdata cant submit null formdata.append('description', null) it makes null a string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.