You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using SpatieMediaLibraryFileUpload, the preview doesn't have access to the uploaded file until the form is saved. As a workaround, you can check for the presence of a TemporaryUploadedFile and pass its temporary URL to your preview:
protectedfunctionmutatePreviewModalData(array$data): array
{
// Get the live value from the page data$featuredImage = collect($this->data['featured_image'])->first();
if ($featuredImageinstanceof TemporaryUploadedFile) {
$data['featuredImagePreviewUrl'] = $featuredImage->temporaryUrl();
}
return$data;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When using
SpatieMediaLibraryFileUpload
, the preview doesn't have access to the uploaded file until the form is saved. As a workaround, you can check for the presence of aTemporaryUploadedFile
and pass its temporary URL to your preview:Form Field
Create or Edit Page Class
Blade View
Beta Was this translation helpful? Give feedback.
All reactions