KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

File-Uploading #2622

Closed Peter Wendel opened this topic on on Mar 30, 2022 - 3 comments

Peter Wendel commented on Mar 30, 2022

Me again ,-)

Of course it's easy and I can see you rolling with your eyes... :) But I didn't see exactly what to do to get the file uploaded.

class StdBoard extends \koolreport\dashboard\Dashboard
{
    protected function widgets()
    {
       return [
           Html::h2('Heilmittel: STD-Datei-Verarbeitung'),
           Html::hr(),
           Row::create()->sub([
              Html::p('fileliste'),
              Panel::create()->header('STD-Upload')->type('primary')->sub([
                  FileUploader::create('std_uploader')
                    ->type('primary')
                    ->accept(["std"])
                    ->saveToFolder(public_path(env('HM_STD_PATH')))
                    ->fileName(function($name,$ext){
                      return $name.".".$ext;
                  })
                  ->resolveValue(function($file){
                      return $file["name"];
                  })
                  ->fileNotAllowedError("Dateityp nicht erlaubt.")
                  ->fileSizeLmitError("Datei ist zu groß!")
                  ->unknownError("So mysterious")
                  ->noFileError("Keine Datei ausgewählt!")
                  ->noFileSelectedText("Keine Datei ausgewählt!")
                  ->selectFileText("STD-Datei auswählen..")
                  ])
           ]),
       ];
    }
}

This is what I've done so far. The FileUloader is working, mainly copied from your documentation.

Now I want to create a Button to upload the selected File, but (maybe it's not my day today...) I don't know how I have to connect that.

Can you help me again?

Thanks, Peter

KoolReport commented on Mar 30, 2022

I see that you marked the case as solved. Could you please share you solution?

Peter Wendel commented on Mar 31, 2022

With the "FileUpload" the File is already uploaded, no need to have an extra button in this case.

Ravoniaina commented on May 25, 2022

Message: Too few arguments to function ticketing\evenements\EvenementsAjour::ticketing\evenements{closure}(), 0 passed in /var/www/clients/client1/web760/web/vendor/koolreport/dashboard/inputs/FileUploader.php on line 148 and exactly 1 expected Line: 99 File: /var/www/clients/client1/web760/web/src/evenements/EvenementsAjour.php, help me

From Support Team: Dear Ravoniaina, We closed the topic because the issue was solved for Peter Wendel, please create new topic for your issue.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

None