symfony - how to use Gaufrette Stream Wrappers? -
if have defined below stream wrapper in symfony2 config.yml:
knp_gaufrette: adapters: my_drive: local: directory: %my_drive_path% create: true filesystems: user_fs: adapter: my_drive alias: my_drive_filesystem stream_wrapper: protocol: data
how can use in controller download file ?
i have this:
$response = new binaryfileresponse("data://user_fs/" . $key);
so call file using addres: "data://user_fs/"
haw can change dont use it, couse if change name in config have change in controller. , want manage in 1 file (config)
you can define path parameter in parameters.yml
:
parameters: data_protocol: data data_filesystem: user_fs data_path: "%data_protocol%://%data_filesystem%/"
and container:
$path = $this->get('system_container')->getparameter('data_path') $response = new binaryresponse($path . $key);
Comments
Post a Comment