选择文件后,控制台会显示这个错误:
刀片文件:
<form wire:submit.prevent="Insert" enctype="multipart/form-data">
<input type="file" wire:model.lazy="img" id="img" name="img"/>
@if ($img)
<img src="{{ $img->temporaryUrl() }}">
@endif
<div wire:loading wire:target="img">در حال آپلود ... </div>
<button type="submit"> Submit </button>
</form>
class livewire $img
是模型:
class Article extends Component
{
use WithFileUploads;
public $img;
public function Insert()
{
dd($this->img);
}
public function render()
{
return view('livewire.article');
}
}