public function ajaxuploadtopbannerAction() { //print_r($_FILES);exit; $name = $_FILES['Filedata']['name'] = '1' . '_' . time() . str_ireplace(array(' ', '_', '-', ','), '', strtolower($_FILES['Filedata']['name'])); $_FILES['Filedata']['type'] = 'image'; $fileHandler = new FM_Components_Util_UploadHandler($_FILES['Filedata']); $mediaFolder = $_POST['type'] == 'icon' ? 'icons' : 'logos'; $folder = $fileHandler->setFolder($mediaFolder); if ($fileHandler->move()) { list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'] . $folder . '/' . $name); //if($width > $_POST['width'] || $height > $_POST['height']) { // print '0'; // exit; //} $insertData['fileName'] = $name; $insertData['width'] = $width; $insertData['height'] = $height; $insertData['type'] = 'LG'; $insertData['active'] = '1'; //$insertData['orgId'] = $id; $returns = array('src' => $folder . '/' . $name, 'height' => $height, 'width' => $width); print Zend_Json::encode($returns); if ($_POST['type'] == 'left') { $banner = new FM_Components_Util_Logo(array('orgId' => $_POST['orgId'])); if (trim($banner->getId()) != '') { FM_Components_Util_Logo::updateBanner(array('orgId' => $_POST['orgId']), $insertData); } else { $insertData['orgId'] = $_POST['orgId']; FM_Components_Util_Logo::insert($insertData); } } if ($_POST['type'] == 'right') { $banner = new FM_Components_Util_MiniwebBanner(array('orgId' => $_POST['orgId'])); if (trim($banner->getId()) != '') { FM_Components_Util_MiniwebBanner::updateBanner(array('orgId' => $_POST['orgId']), $insertData); } else { $insertData['orgId'] = $_POST['orgId']; FM_Components_Util_MiniwebBanner::insert($insertData); } } if ($_POST['type'] == 'icon') { $icon = new FM_Components_Util_Icon(array('orgId' => $_POST['orgId'])); //print_r($icon); if (trim($icon->getId()) != '') { FM_Components_Util_Icon::updateIcon(array('orgId' => $_POST['orgId']), $insertData); } else { $insertData['orgId'] = $_POST['orgId']; FM_Components_Util_Icon::insert($insertData); } } //($_POST['type'] == 'left') ? FM_Components_Util_Logo::insert(array($insertData)) : FM_Components_Util_MiniwebBanner::insert(array($insertData)); exit; } }