Controller/AlbumsController.php
public function upload($model = null, $model_id = null)
    {
        ini_set("memory_limit", "10000M");

        if (isset($this->params['gallery_id']) && !empty($this->params['gallery_id'])) {
            $album = $this->Album->findById($this->params['gallery_id']);
        } else {
            # If the gallery doesnt exists, create a new one and redirect back to this page with the
            # gallery_id
            $album = $this->Album->init($model, $model_id);

            # Redirect back to this page with an album ID
            $this->redirect(
                array(
                    'action' => 'upload',
                    'gallery_id' => $album['Album']['id']
                )
            );
        }

        $files = $album['Picture'];

        $this->set(compact('model', 'model_id', 'album', 'files'));
    }
public function upload($model = null, $model_id = null)
    {
        ini_set("memory_limit", "10000M");

        if (isset($this->params['gallery_id']) && !empty($this->params['gallery_id'])) {
            $album = $this->Album->findById($this->params['gallery_id']);
        } else {
            # If the gallery doesnt exists, create a new one and redirect back to this page with the
            # gallery_id
            $album = $this->Album->init($model, $model_id);

            # Redirect back to this page with an album ID
            $this->redirect(
                array(
                    'action' => 'upload',
                    'gallery_id' => $album['Album']['id']
                )
            );
        }

        $files = $album['Picture'];

        $this->set(compact('model', 'model_id', 'album', 'files'));
    }
Create or find the requested album
@param null $model
@param null $model_id