Add file type validation

This commit is contained in:
Abhishek Kumar
2023-02-09 15:18:51 +05:30
parent 182acca7b9
commit ba9083af26

View File

@@ -1703,6 +1703,10 @@ class AdminOrdersControllerCore extends AdminController
$this->errors[] = $this->l('Please upload a document.');
} elseif ($objHotelBookingDocument->fileInfo['size'] > Tools::getMaxUploadSize()) {
$this->errors[] = $this->l('Uploaded file size is too large.');
} elseif(!ImageManager::isRealImage($objHotelBookingDocument->fileInfo['tmp_name'])
|| $objHotelBookingDocument->fileInfo['mime'] != 'application/pdf'
) {
$this->errors[] = $this->l('Please upload an image or a PDF file only.');
}
if (!count($this->errors)) {