1. Setting your custom options in application.ini

Suppose you want to store the uploaded files to /data/uploads , and access them via http://youhost/uploads/thefilename

Here's an Example:

;; where to store user uploaded files.
upload.savePath = "/data/uploads"
;; the uri access these files.
upload.uriMap = "/uploads"

2. How to get these setting

;; in Bootstrap.php 

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

   // other _initXXX

   protected function _initUpload() {

        $uploadOptions = $this->getOption('upload');
       
        var_dump($uploadOptions);

   }

}

you will see:

array
  'savePath' => string '/data/uploads' (length=13)
  'uriMap' => string '/uploads' (length=8)


Date: 2011-12-30 01:05:22 and last modified: 2012-01-14 23:04:39

Relate tags:

Hot tags: