GX-Bug #45484 » AttachmentsApiV2Controller_inc_php_does_not_use_the_AttachmentHandler_class_correctly_.patch
src/GXEngine/Controllers/Api/v2/AttachmentsApiV2Controller.inc.php (revision ) | ||
---|---|---|
70 | 70 |
} |
71 | 71 |
|
72 | 72 |
// Get the first item of $_FILES array. |
73 |
$emailAttachment = $this->attachmentsHandler->uploadAttachment(array_shift($_FILES)); |
|
73 |
$file = array_shift($_FILES); |
|
74 |
$tmpAttachmentPath = MainFactory::create('AttachmentPath', $file['tmp_name']); |
|
75 |
$tmpAttachmentName = MainFactory::create('AttachmentName', $file['name']); |
|
76 |
$tmpEmailAttachment = MainFactory::create('EmailAttachment', $tmpAttachmentPath, $tmpAttachmentName); |
|
77 |
$newEmailAttachment = $this->attachmentsHandler->uploadAttachment($tmpEmailAttachment); |
|
74 | 78 |
|
75 | 79 |
// Return success response to client. |
76 | 80 |
$response = array( |
77 | 81 |
'code' => 201, |
78 | 82 |
'status' => 'success', |
79 | 83 |
'action' => 'upload', |
80 |
'path' => basename($emailAttachment->getPath())
|
|
84 |
'path' => basename($newEmailAttachment->getPath())
|
|
81 | 85 |
); |
82 | 86 |
|
83 | 87 |
$this->_writeResponse($response, 201); |