Delete asset and temporary link


1 comment

  • Avatar
    Loic Verger Del Bove

    Hi Nicolas,

    Thanks for sharing your use case.

    I actually think that the `rename` method is the method to use here. 

    In your use case, there are 2 options, if the user submits the form or not. When the user starts to add media I would upload assets in a directory like `tmp/user_id/`.

    When the user submits the form, I would rename all the images from `tmp/user_id/filename` to `user_id/filename`. As mentioned in the documentation here, you can actually use the `overwrite` and `invalidate` parameters and set them to `true` in order to make sure that when renaming, the `tmp` path won't work and all the images will have the last version.

    When the user doesn't submit the form, you can actually delete the images in the  `tmp/user_id` folder via the destroy method, using the same parameters to remove access to the `tmp` files.

    Hope that helps.



    Comment actions Permalink

Please sign in to leave a comment.