Skip to content

Instantly share code, notes, and snippets.

@jahvi
Created November 11, 2015 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jahvi/dff8e077b8cf7530a13a to your computer and use it in GitHub Desktop.
Save jahvi/dff8e077b8cf7530a13a to your computer and use it in GitHub Desktop.
Change allowed file extensions
<?php
public function changeAllowedFileExtensions(Varien_Event_Observer $observer) {
$file = $observer->getEvent()->getFile();
// Add new '.mp4' file extension to the list
$allowedExtensions = $file->getData('allowed_extensions');
$allowedExtensions[] = 'mp4';
$file->setData('allowed_extensions', $allowedExtensions);
// Or, ignore default list and only allow '.pdf' files
$file->setData('allowed_extensions', array('pdf'));
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment