Uploading files temporary before creating model #1925
-
Hello there, how would you handle a file upload that will upload and validate files before the related post is created by the user? Currently i am creating a model with "is_draft" flag, that will have a relationship with all files/media uploaded. After the user creates the post the post will be published by removing the "is_draft" field. This works good. But now, the user edit the post and upload a new file to it, the post is published already and other users can see related files even the user has not saved his changed to the post. So my question is, is it a good way to use custom properties on each file for that to handle as a temporary file? https://docs.spatie.be/laravel-medialibrary/v8/advanced-usage/using-custom-properties/ So each file/media will get a custom property "is_draft" or "temp" to identify files that are not finally related to the post. On updating i will check all files that have the custom property "is_draft" and remove that property to show all files related without the custom property. Sounds good? Sounds bad? Any ideas? Thanks :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That sounds like a good approach to me. We will also handle temporary files and uploads in the upcoming https://medialibrary.pro |
Beta Was this translation helpful? Give feedback.
That sounds like a good approach to me.
We will also handle temporary files and uploads in the upcoming https://medialibrary.pro