Posted By

TioSolid on 05/06/11


Tagged

file magento


Versions (?)

Uploading Files in Magento


 / Published in: PHP
 

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

  1. if (isset($_FILES['logo']['name']) && $_FILES['logo']['name'] != '') {
  2. try {
  3. $uploader = new Varien_File_Uploader('logo');
  4. $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
  5. $uploader->setAllowRenameFiles(false);
  6. $uploader->setFilesDispersion(false);
  7. $path = Mage::getBaseDir('media') . DS;
  8. // $path = Mage::getBaseDir('media') . DS . 'logo' . DS;
  9. $logoName = $_FILES['logo']['name'];
  10. $uploader->save($path, $logoName);
  11.  
  12. } catch (Exception $e) {
  13.  
  14. }
  15. }

Report this snippet  

You need to login to post a comment.