Hi,
I have a widget that displays a file upload button and some function that is triggered on upload. But how can I then display a success note/alert when fileHandle is finished?
protected function widgets()
{
return [
Row::create([
Panel::create()->sub([
Row::create([
Inline::create([
FileUploader::create("import_products")
->type("primary")
->accept(["csv"])
->notAccept(["php"])
->maxFileSize(2000000)
->imagePreview(true)
->showDownloadLink(true)
->previewWidth("150px")
->previewHeight("150px")
->fileHandle(function($file){
$name = $file["name"];
$filePath = $file["tmp_name"];
ImportProducts::import($name, $filePath);
// want to show note/alert to user when file Handle is complete
})
->resolveValue(function($file){
return $file["name"];
})
])
]),
]),
]),
];
}
Thank you, Jernej