"driver does not support creating temporary URLs" with image temporaryUrl() + validation #3133
Replies: 4 comments 3 replies
-
Duplicate of #1106 — see possible workaround in the comments. |
Beta Was this translation helpful? Give feedback.
-
Hi, This solve the issue, this happened to me after upgrade livewire |
Beta Was this translation helpful? Give feedback.
-
Hi, I was thinking that maybe it's a context problem. There is no need to use the temporaryUrl function if you not expect an image, which can be previewed. But, sometimes, we click in the wrong file and then, there is a crash. What lead us to deal with this problem in the front and maybe with an ugly solution. And I thought that we could display an image in base64 that inform us that this file can not be previewed. So, the solution that I put in my project was to insert this in line 86 of TemporaryUploadedFile.php: if( ! $this->isPreviewable() ) For me it work's, both in code and in thoughts process, because dont break de flow and show to the user that there is something wrong with the file. "Hey, it was supossed to be an image". And then, when the user submit the form without change the file, the validation will be triggered. What you guys, think about it? |
Beta Was this translation helpful? Give feedback.
-
@klesou Livewire is basically unusable for file uploads because of this stupid (and old!) I put it on line 78, right at the top of the You should submit a PR and get this adopted. :) public function temporaryUrl()
{
if (! $this->isPreviewable()) {
// show a missing image icon (?) for files that cannot be previewed
return 'data:image/png;base64...gg==';
}
...
} |
Beta Was this translation helpful? Give feedback.
-
Description
When the user uploads the wrong file format it should prevent $photo to get updated and keep it null or previous value so temporaryUrl() should not work.
but when the user uploads the wrong file format it still changes $photo so in frontend temporaryUrl() gets called and shows an error.
validation should work before $photo update but it works after the update so it shows this kind of error :(
Exact steps to reproduce
Stripped-down, copy-pastable code snippets
Context
Beta Was this translation helpful? Give feedback.
All reactions