How to configure the file hooks after a file uploaded in document of next cloud 12

Hi team,
Actually I have a requirement like a shell script need to be called once after the file uploaded into document in next cloud 12. Last few days I am trying this scenario but I did not able to achieve that through file hooks. Please explain whether it would be achievable by file hooks or any other way is there which I can environment is like next cloud 12, docker ,nginx,php7 . If possible please put the clear steps for file hooks after file upload.

You should have a look to the Activity apps

Thanks Cult. I have gone through those filehooks ,filehooksstatic and hooks .php files…But I did not get any information like where I can make a call to my shell script which is located in use/share/nginx/HTML/next cloud/my
Please share with me the steps how to implement the hooks after file uploaded.

Alright, so to summarize, you have your hook working already.
Now, please be aware that the action you perform from the hook is on the same process than the upload of the file. In case of a single file upload, there is no real issue, but if a user start uploading multiple small file and your script is taking too long for each file, the UX will be awful.

The solution would be to generate an entry in a database table of your own with the information about the new uploaded file, and run/call your script from a cronjob (using the cron system from Nextcloud or your own). Note: in the database store the file ID, not the file name, in case the user rename the file before the call of the script.
This way, it might be even easier for you to call that shell script. (even if I am not a fan of running a shell script from a php script ;p)

Hi Cult
I had a discussion with my customer and they will be uploading single file always. So we can go-ahead with filehook. Please tell me the steps to implement that scenario as discuss before.


Hi team
Please help me out for file hooks implementation in next cloud 12.