Uploading file using Livewire and Tailwind.
composer require akhaled/livewire-files
Frontend packages are required:
This component only displays a button within your content. This button is linked to tailwind modal.
@livewire('files-upload', [
'image' => true, // accept only image, optional
'mimes' => 'pdf,csv', // or specify mime type, optional
'max' => 1024 // max 1024kb by default
])...
@livewireScript
<script src="{{ mix('js/app.js') }}"></script>
@livewireSweetalertScripts
...php artisan vendor:publish --tag=livewire-files
Will generate global config file.
Default is public (storage/public). You need to add the following line in config/filesystems.php under links property:
public_path('storage') => storage_path('app/public')
image: only accept images, default =falsemimes: accepted mimes, default =null(accepting everything)max: maximum uploaded size, default =102400(in kilobytes)
- Show toast on uploaded!
- Hide input file and show javascript link
- Move content to modal
- Show sweetalert popups instead of static alert
- Add button text and button color for upload button
- Specify upload files names
- Move uploads to directory year/month/day