@Snapey
audio-upload.blade.php
<form wire:submit="save">
<input type="file" wire:model="audio">
@error("audio") <span class="error">{{ $message }}</span> @enderror
</form>
AudioUpload .php
<?php
namespace App\Livewire;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Livewire\WithFileUploads;
class AudioUpload extends Component
{
use WithFileUploads;
#[Validate('required|max:1024')]
public $audio;
public function save()
{
\Log::info("FINALLY SAVED AUDIO FILE");
$this->audio->store(path: 'public');
}
public function render()
{
return view('livewire.audio-upload');
}
}
its basically copy paste from livewire doc. i also tried without the form and the page still makes a full reload when file is uploaded. (files are uploading ok).
this is the base layout, before you ask, i also removed every script and/or imported library that might be causing trouble.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<!-- Scripts -->
@livewireStyles
@stack('scripts')
@vite(['resources/css/app.css','resources/css/tippy.css','resources/css/animations.css', 'resources/css/scoreBar.css',
'resources/css/sideshop_fonts.css','resources/js/app.js'])
</head>
<body class="font-standard antialiased">
<div class="min-h-screen">
<div class="z-10 relative">
@include('layouts.navigation')
</div>
<main>
<livewire:audio-upload />
</main>
</div>
@livewireScriptConfig
@stack('scripts_after_end')
</body>
@include('layouts.footer')
</html>
app.js
import "./bootstrap";
import { Livewire, Alpine } from '../../vendor/livewire/livewire/dist/livewire.esm';
import Tooltip from "@ryangjchandler/alpine-tooltip";
import Quill from 'quill';
import 'quill/dist/quill.snow.css';
window.Quill = Quill;
import.meta.glob([
// '../assets/images/**',
// '../assets/fonts/**',
]);
Alpine.plugin(Tooltip);
Livewire.start();
THE LOG IN THE SAVE FUNCTION IS NEVER EXECUTING
do i need to set up any route in web.php for uploads?