Logo-amall

I use hasura storage to upload files to a bucket spaces of digitalocean. But the files are private, I would like to know if it is possible to configure public ACL, Thanks

Last active 3 months ago

20 replies

9 views

  • DI

    I use hasura storage to upload files to a bucket spaces of digitalocean. But the files are private, I would like to know if it is possible to configure public ACL, Thanks

  • DA

    you can give the public role read permissions to the files and buckets tables

  • DI

    Thanks

  • DI

    on the other hand, when I send several files, only one is uploaded

  • EL

    How can I reproduce this on my side? Sounds like a bug

  • DI
  • DI

    With postman

  • DI

    I selected two files, but only one was uploaded

  • DI

    with next

  • EL

    Ah, that's by design. You can only upload one file at the time.

  • EL

    Maybe you can use the nhost.storage.upload() (https://docs.nhost.io/reference/javascript/storage/upload) or useFileUpload() (https://docs.nhost.io/reference/nextjs/use-file-upload) ?

  • DI

    No worries thank you, I understood that we could upload several files.

  • EL

    Just to be clear. You can only upload one file per upload-request.

  • DA

    just to add a bit of nuance to Johan's comment; our SDK doesn't support it but hasura-storage's API does. I am not sure how this translates to postman or your next code but here is an example with curl: https://github.com/nhost/hasura-storage/blob/main/example_curl.sh#L14-L26 (the metadata in the example isn't required)

  • DI

    Thanks to you I found the solution. you have to add square brackets in the name of the key ("file[]" and not "file"). Thanks a lot

  • DI
  • DI

    I have another question. How to allow deletion only by the user who uploaded. because uploadByUserId is depreciated

  • EL

    I would store the file id somewhere in your database in the public schema to keep track metadata like this

  • EL

    You can then create relationships and permissions based on that.

  • DI

    Okay thanks

Last active 3 months ago

20 replies

9 views