-
Notifications
You must be signed in to change notification settings - Fork 0
MVC Usage
Joey Smith edited this page Jun 13, 2023
·
1 revision
- A class (model usually) that will expose handleUpload and handleDelete methods.
These methods are solely responsible for "what" should happen to the file when it is uploaded or deleted. If you want the information saved to a db, then this is when it should happen.
-
Your Controller must implement the UploaderAwareInterface and should use the UploaderAwareTrait to implement the interface.
-
Your file should come in via a file upload under the POST key file-data
$eventResponse = $this->getEventManager()->trigger(UploaderEvent::EVENT_UPLOAD, $yourModel, $postData['file-data']);
if ($eventResponse->last()) {
// upload success
}