what is the document root of your website
Nov 28, 2022
9
Level 1
The photo failed to upload ! Console POST 500 (internal Server Error)
Hi, i am new to livewire. I am just following docs. https://laravel-livewire.com/docs/2.x/file-uploads where i have made basic file upload. as below
UploadPhoto.php
namespace App\Http\Livewire;
use Livewire\Component;
use Livewire\WithFileUploads;
class UploadPhoto extends Component
{
use WithFileUploads;
public $photo;
public function save()
{
$this->validate([
'photo' => 'image|max:1024', // 1MB Max
]);
$this->photo->store('photos');
}
public function render()
{
return view('livewire.upload-photo');
}
}
and blade file.
<form wire:submit.prevent="save">
<input type="file" wire:model="photo">
@error('photo') <span class="error">{{ $message }}</span> @enderror
<button type="submit">Save Photo</button>
</form>
but when i am selecting file without submitting form i am getting error "The photo failed to upload" and in console i see POST http://laralive.test/livewire/upload-file?expires=1669637723&signature=c65fde13d14abf55dec3e81454040ccab1986fef5b811d5382b745d6320d233f 500 (Internal Server Error)
any idea what is going on?
Regards, Morty
Please or to participate in this conversation.