Magento – Magento media uploader

magento-1.7module

I am straggling making a module for a site that needs something like photo gallery.My problem is that i am trying to do the same media uploader that magento uses for products.I can't understand how it is implemented or how i can do it for my module.I tried to follow those links:
x
Add Media Uploader to Custom Module
but i can't find the code attached or how to do it.So my question is how can i start with it?Is there anything i can read to understand what do i need to implement the same media uploding process that products have?

Best Answer

I would say, start here:

\Mage_Adminhtml_Catalog_Product_GalleryController::uploadAction

The flex uploader makes a real HTTP upload, this means the controller handles just a standard upload.

On the client side a Flex.Uploader is instantiated:

/app/design/adminhtml/default/default/template/media/uploader.phtml:66
new Flex.Uploader(
    'ID of the html div container',
    '<?php echo $this->getUploaderUrl('media/uploader.swf') ?>',
    <?php echo $this->getConfigJson() ?>
);

And the config you get from here:

\Mage_Adminhtml_Block_Media_Uploader::__construct()

Good luck.

Related Topic