Detect backend file uploaded, changed or deleted #938
-
I have files attached to a model using attachOne or attachMany. Fields in the backend form are of type fileupload and attachOnUpload is set true. I need to detect when a file is added, deleted or changed and run some code if so, either in the model or controller. I've tried using beforeUpdate but the data is not available to detect change presumably particularly as attachOnUpload is true. How can I connect to the onUpload or onRemoveAttachment actions, e.g. with events? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
See https://wintercms.com/docs/events/event/backend.ajax.beforeRunHandler and https://github.com/wintercms/winter/blob/develop/modules/backend/formwidgets/FileUpload.php#L425-L431 |
Beta Was this translation helpful? Give feedback.
See https://wintercms.com/docs/events/event/backend.ajax.beforeRunHandler and https://github.com/wintercms/winter/blob/develop/modules/backend/formwidgets/FileUpload.php#L425-L431