Mage_Adminhtml_Catalog_Product_GalleryController Class Reference

Inheritance diagram for Mage_Adminhtml_Catalog_Product_GalleryController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 uploadAction ()

Protected Member Functions

 _isAllowed ()


Detailed Description

Definition at line 34 of file GalleryController.php.


Member Function Documentation

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 64 of file GalleryController.php.

00065     {
00066         return Mage::getSingleton('admin/session')->isAllowed('catalog/products');
00067     }

uploadAction (  ) 

Definition at line 36 of file GalleryController.php.

00037     {
00038         $result = array();
00039         try {
00040             $uploader = new Varien_File_Uploader('image');
00041             $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
00042             $uploader->setAllowRenameFiles(true);
00043             $uploader->setFilesDispersion(true);
00044             $result = $uploader->save(
00045                 Mage::getSingleton('catalog/product_media_config')->getBaseTmpMediaPath()
00046             );
00047 
00048             $result['url'] = Mage::getSingleton('catalog/product_media_config')->getTmpMediaUrl($result['file']);
00049             $result['file'] = $result['file'] . '.tmp';
00050             $result['cookie'] = array(
00051                 'name'     => session_name(),
00052                 'value'    => $this->_getSession()->getSessionId(),
00053                 'lifetime' => $this->_getSession()->getCookieLifetime(),
00054                 'path'     => $this->_getSession()->getCookiePath(),
00055                 'domain'   => $this->_getSession()->getCookieDomain()
00056             );
00057         } catch (Exception $e) {
00058             $result = array('error'=>$e->getMessage(), 'errorcode'=>$e->getCode());
00059         }
00060 
00061         $this->getResponse()->setBody(Zend_Json::encode($result));
00062     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:10 2009 for Magento by  doxygen 1.5.8