Skip to content

thibaultboursier/file-uploads

 
 

Repository files navigation

How do I upload files in Sails?

Example of using Sails to properly/safely stream file uploads to S3 and/or disk (esp. really big uploads).

Trying it out

Clone this repo, npm install, then start the server with sails lift. Or deploy it on Heroku with:

Deploy

Upload file(s) to disk

POST /file/upload

Run in Postman

See api/controllers/FileController.js.

To download a file from disk, see https://github.com/sails101/file-uploads/blob/master/api/controllers/FileController.js#L82. A request also exists for this on Postman. The built-in action downloads a file from disk at the specified path-- this is purely for grabbing something you just uploaded. In production, you should use a different id (not the fd of the uploaded file).

Upload file(s) to S3

POST /file/s3upload

Run in Postman

See api/controllers/FileController.js.

To download a file from S3, talk to the Amazon S3 API directly.

About

How do I upload files in Sails?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 66.8%
  • HTML 32.9%
  • CSS 0.3%