How does the file get uploaded?
Detect when file uploaded to a folder in "public"
I was wondering how I could go about detecting the presence of new files in a particular folder in public, eg I have public/uploads/results which will have a results file uploaded to it 3am every day. I would like to detect when the file has been uploaded so I can then grab it and process the data to add to the database.
I've been searching around but can't seem to find any examples or suggestions on how I could do this.
I've thought about using the laravel scheduler and then check for new files through that, but I can't seem to get the scheduling to work in Windows (the task scheduler only seems to run it once, even though I set it to go every minute).
Thanks for the hints and suggestions, much appreciated.
I've created my own console command and have it successfully scheduled.
My console command gets the list of files from the folder using Storage::listContents().
I then compare this list with my list in the DB of processed files and discard what has been processed.
If there are any elements left in the array, then I fire my event to process the file or files.
Seems to be working quite well too.
Please or to participate in this conversation.