For ECG you should avoid using "superglobals", but is there any Magento, Zend or Varien method to replace $_FILES? Couldn't find anything in Mage_Core_Controller_Request_Http or Zend_Controller_Request_Http or Zend docuomentation.

1 Answer 1


One way you can used Object Manager and Media Storage Uploader of magento to get $_FILES data.I know using object manager is not a good idea.

 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
 $fileSystem = $objectManager>create('\Magento\Framework\Filesystem');
 $uploader = $objectManager->create('Magento\MediaStorage\Model\File\Uploader',['fileId' => 'file']);    
 $uploader->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png']);
 $imageAdapter = $objectManager->get('Magento\Framework\Image\AdapterFactory')->create();
 $result = $uploader->save($mediaPath);
  • 1
    quesrtion is abount magento1 not magento2,Please check question.
    – Amit Bera
    Jul 26, 2017 at 5:55

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .