litstack / litstack

Build content-administration-panels in Laravel
https://litstack.io
MIT License
857 stars 87 forks source link

input type file litstack #259

Open lordjack opened 2 years ago

lordjack commented 2 years ago

Hi everyone, I checked all litstack documentation However, I didn't find any example using file upload with "input" "type='file'" as an example. Does anyone have any examples that you could share?

nikolai-nikolajevic commented 2 years ago

This is already there but not in the documentation. I found it in /vendor/litstack/litstack/src/Crud/Fields/Media/File.php

Use it with $form->file('myFile')

The default Settings are:

maxFileSize(12);
maxFiles(5);
override(false);
sortable(true);
accept('application/pdf');

You can customize it with

$form->file('myFile')
     ->maxFiles(1)
     ->accept(['application/pdf', 'application/zip'])
lordjack commented 2 years ago

This is already there but not in the documentation. I found it in /vendor/litstack/litstack/src/Crud/Fields/Media/File.php

Use it with $form->file('myFile')

The default Settings are:

maxFileSize(12);
maxFiles(5);
override(false);
sortable(true);
accept('application/pdf');

You can customize it with

$form->file('myFile')
     ->maxFiles(1)
     ->accept(['application/pdf', 'application/zip'])

Thanks. I will test this example. If it works return here warning if it worked.