I uploaded additional files for products. They get stored in media folder in Magento root directory. How can I access files stored at media folder in Magento root folder? Should I use a method for accessing files outside Root directory or simply involve a direct access code in php?

1 Answer 1


It depends from where you want to call that access from; there's 2 possibilities:

  1. from within the Magento Administration - say, a CMS page or a Block. There, you can refer to the 'media' directory via

  2. from a template-file (phtml)

    1. refer to the skin directory:

      <img src="<?php echo $this->getSkinUrl('images/filename.jpg')?>" 
    2. refer to the media directory:

      <?php echo  Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?> 

There's also plenty of sources:

See Magento-Forum or stanleytips.com for starters

  • So I should use Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); where URL_TYPE_MEDIA is the path to the media directory? Jul 11, 2014 at 8:09
  • If you work with a template file (*.phtml) - yes, that's what I would try first.
    – Johannes
    Jul 11, 2014 at 8:12

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.