Hi, What do I do wrong?
class MyBoard extends Dashboard
{
protected function content(){
return[ FileUploader::create('myFileUploader')
->type('primary')
->accept(['jpg', 'png'])
->notAccept(['php'])
->maxFileSize(200000)
->imagePreview(true)
->showDownloadLink(true)
->previewWidth('150px')
->previewHeight('150px')
->fileName(function ($name, $ext) {
return $name . '.' . $ext;
})
->fileHandle(function ($file) {
$name = $file['name'];
$tmp = $file['tmp_name'];
//You can do any thing to handle your file here
})
->resolveValue(function ($file) {
return $file['name'];
})
// ->resolveUrl(function ($value) {
// return "https://examples.com/images/$value";
// })
->fileNotAllowedError('Not allowed')
->fileSizeLmitError('Oversized')
->unknownError('So mysterious')
->noFileError('No file was selected')
->noFileSelectedText('No file was selected')
->selectFileText('Select a file..')
];
}
}
In Safari: The uploader input appears on the page, I can open the window to select a file. But it does not even filter the possible files in Safari. So I think it is perhaps not compatible with Safari... I always see No file selected. No Error messages anywhere
In Chrome: it filters but after I select the file I get the error message:
[Widget] myFileUploader
Message: Too few arguments to function ***Special\WineReport\Boards\MyBoard::Special\WineReport\Boards\{closure}(), 0 passed in /home/resto/domains/***/public_html/vendor/koolreport/dashboard/inputs/FileUploader.php on line 181 and exactly 1 expected
Line: 30
File: /home/resto/domains/***/public_html/src/Special/WineReport/Boards/MyBoard.php
Collapse
#0: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/inputs/FileUploader.php Line 181 : ***\Special\WineReport\Boards\{closure}(null)
#1: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/inputs/FileUploader.php Line 73 : fileHandle(null)
#2: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/TAction.php Line 37 : actionUpload(null)
#3: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/Widget.php Line 128 : action(null)
#4: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/Dashboard.php Line 262 : handle(null)
#5: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/pages/Main.php Line 175 : handle(null)
#6: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/Application.php Line 361 : handle(null)
#7: /home/resto/domains/***/public_html/vendor/koolreport/dashboard/Application.php Line 270 : handle(null)
#8: /home/resto/domains/***/public_html/index.php Line 6 : run(null)
As you can see I use exactly your example. except commented resolveUrl