socketio-file-upload
socketio-file-upload copied to clipboard
Upload mutiple files?
Is there any way to upload multiple files in a single go and save them in different directories using supplied metadata?
Referenced some useful link/s here:
- https://stackoverflow.com/questions/46857545/using-socketio-file-upload-to-upload-multiple-files
I posted an answer on that StackOverflow question. However, this seems like a reasonable feature to add, and it wouldn't be too hard. Here's how I'd do it (all changes in client.js):
-
listenOnSubmit
:- pass
input
as the second argument to_baseFileSelectCallback
- pass
-
_baseFileSelectCallback
:- add a second argument named
element
- pass it to the "choose" event in the object literal:
element: element
- note: if
element
is undefined (not passed to_baseFileSelectCallback
), then that value will be undefined in the object literal, which is fine
- add a second argument named
Oh, and then the answer would be adding a listener on the "choose" event in userland, which would now have access to the file metadata and can add information based on the element the input came from.
In terms of saving the files in different directories, no, that's not going to be possible right now. However, if you add the information you want to the file.meta, you can just move the files on the server after they are finished uploading.
If you want to make a PR, I'll be happy to review it for you.
I wasn't expecting @sffc would reply within a day! 😎 Btw, thanks for this dude! Really loving this library 🎉 Right now i'm workin' on some stuff but i'll submit a PR. Thanks again. 👌