Search code examples
node.jsfile-uploadbackendkuzzle

How to use file upload with Kuzzle


I use Kuzzle as a backend for my progressive web app and I wanted to do some file upload.

As far I can see, Kuzzle does not support server side file storage.

How can I upload images from my application and then display them to other users?


Solution

  • EDIT (2019-05-20): Since this is a very current feature in mobile or web application, we have developed a Kuzzle Plugin that allows to upload file to S3 using Presigned Urls: https://github.com/kuzzleio/kuzzle-plugin-s3

    Check out the README: https://github.com/kuzzleio/kuzzle-plugin-s3#example-using-the-javascript-sdk

    ORIGINAL RESPONSE:

    Kuzzle does not natively handle file upload.

    The best way to handle file upload is to use an external service like Amazon S3 or Cloudinary to upload your file in the client side and then store the file URL and metadata into Kuzzle.

    You can develop a Kuzzle plugin to generate S3 presigned upload URLs with a tiny TTL and then use this URL to upload you file directly to your S3 bucket.
    This way you can use Kuzzle authentification and rights management system with your file upload.

    Here you have some resources about presigned URL: https://medium.com/@aakashbanerjee/upload-files-to-amazon-s3-from-the-browser-using-pre-signed-urls-4602a9a90eb5

    And you will need to develop a Kuzzle plugin with a custom controller to generate these URLs: https://docs.kuzzle.io/plugins/1/controllers

    Full disclosure: I work at Kuzzle as core developer