I want to upload a simple file using a skipper. Previously, files uploaded through forms could be retrieved using req.files, but they learned that in Sails 0.10.x with the default gateway, req.files is undefined. Instead, req.file ('filename') is used to access the file.
I could do a simple file upload by looking at the documentation. However, I want to have access to the file name before downloading it, as well
- Upload the file to a dynamically created directory based on the user who uploaded it
- The name of the newly created file should be oldFileName + _ + timestamp in integer
How can I do this with the skipper module, or rather, the most efficient way to do this?
EDIT
So far, I have been able to do this, but I hope that there should be a better way.
I used this expression to access the file name
var inputFileName = req.file('inputFile')._files[0]["stream"]["filename"];
I could see that the skipper automatically creates a directory if it is not based on the path to the file and the name specified in the parameter to load the function
source share