Return to Snippet

Revision: 45726
at May 6, 2011 07:55 by TioSolid


Initial Code
if (isset($_FILES['logo']['name']) && $_FILES['logo']['name'] != '') {
    try {
        $uploader = new Varien_File_Uploader('logo');
        $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
        $uploader->setAllowRenameFiles(false);
        $uploader->setFilesDispersion(false);
        $path = Mage::getBaseDir('media') . DS;
        // $path = Mage::getBaseDir('media') . DS . 'logo' . DS;
        $logoName = $_FILES['logo']['name'];
        $uploader->save($path, $logoName);
 
    } catch (Exception $e) {
 
    }
}

Initial URL
http://blog.chapagain.com.np/magento-how-to-upload-file/

Initial Description

                                

Initial Title
Uploading Files in Magento

Initial Tags
file, magento

Initial Language
PHP