-
I'm wrapping a bunch of media into a ZIP file for download, but if the physical file of just one media item is not present, the whole thing throws an exception. What I would like to do, is to check the physical files for each media actually exist on storage, before trying to push it into the ZIP file. I was hoping for something as simple as Flysystem has Is there a built-in way to do this that I am missing? If not, are there any short-cuts to finding out, for example getting a Flysystem reader and the path from the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think this is what I needed, where
Possiblly:
I'm not sure when the two path values would differ - they are both identical for me - so I will assume one will be wrong in certain contexts. I always thought Flysystem paths already were always relative to the root of the filesystem, so 🤷 . Again, it would be nice if this were wrapped up in Finally - the method |
Beta Was this translation helpful? Give feedback.
I think this is what I needed, where
$media
is a single media item, so if your collection has more then one item, you would need to loop over the$model->media
collection:Possiblly:
I'm not sure when the two path values would differ - they are both identical for me - so I will assume one will be wrong in certain contexts. I always thought Flysystem paths already were always relative to the root of the filesystem, so 🤷 .
Again, it would be nice if this were wrapped up in
$media->fileExists()
, though I could imagine options to select for the conversi…