1

i have this code:

if(isset($_FILES['featured_image']['name']) and (file_exists($_FILES['featured_image']['tmp_name']))) {
   try {
      $uploader = new Varien_File_Uploader('featured_image');
      $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
      $uploader->setAllowRenameFiles(false);

      // setAllowRenameFiles(true) -> move your file in a folder the magento way
      // setAllowRenameFiles(true) -> move your file directly in the $path folder
      $uploader->setFilesDispersion(false);

      $path = Mage::getBaseDir('media') . DS ;

      $uploader->save($path, $_FILES['featured_image']['name']);

      $data['featured_image'] = $_FILES['featured_image']['name'];
   }catch(Exception $e) {

   }
}

// handle delete image
else {
   if(isset($data['featured_image']['delete']) && $data['featured_image']['delete'] == 1)
      $data['image_main'] = '';
   else
      unset($data['featured_image']);
}

i want change this line

$path = Mage::getBaseDir('media') . DS ;

and how can i change media directory to media/blogpic

i will thankful if you experts answer this

0
$path = Mage::getBaseDir('media') . DS . "foobar";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.