Last active
December 29, 2015 04:19
-
-
Save caferrari/7613910 to your computer and use it in GitHub Desktop.
ZF2 Upload Directory config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// module/Application/src/Application/Controller/FilesController.php | |
# ... | |
class FilesController | |
{ | |
#... | |
public function indexAction() | |
{ | |
$uploadDir = $this->getService('upload')->directory; | |
} | |
protected function getService($service) | |
{ | |
return $this->getServiceLocator()->get($service); | |
} | |
#... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// module/Application/Module.php | |
#... | |
class Module | |
{ | |
#... | |
public function getServiceConfig() | |
{ | |
return array( | |
#... | |
'upload' => function ($sm) { | |
return (object)$sm->get('Config')['upload']; | |
} | |
#... | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// config/autoload/upload.global.php | |
return array( | |
'upload' => array( | |
'directory' => '/pasta/dos/uploads/', | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment