still struggling to pass data from FileUpload in filament resource to my command script
As the title suggests, I would like my script to read the data and run, according to excels I upload. Currently it only works with hardcoded excel files that I store in storage/app/public. Here is a github gist link to my code.
https://gist.github.com/Benjji92/42839a5088fb052e624c4d480672e94e
Any help would be much appriciated as Im struggling to do this for the past days.
8 Replies
1) dont use SpatieMediaLibraryFileUpload, just FileUpload
2) in the action() function, you will recieve
$data
. that will contain the path to the uploaded file which you can pass to the commandmy bad i forgot to change it in github gist but im actually using just FileUpload
when i dd($data) it only contains the name of the uploaded file
yeah
whats the problem
thats the file that you can get data from
im a self made beginner programmer so im not exactly sure how to do this, i thought since there is only the name in the dd() the path is missing from there
its in whatever storage disk you told it to upload to, public disk by default
have a look in your file explorer
i just noticed that it gets saved there only after i press the run button for the script, so i might need to do a seperate Action for the upload before the scripts Action for it to work
attach the file, click Import and then the file is uploaded and the command will run
i wanted to do the file upload and run the script with one button click but i guess its not doable like this