All pastes #621884 Raw Edit

Something

public text v1 · immutable
·published 2007-07-16 14:09 UTC
rendered paste body
FUNCTION IN THE CONTROLLER:

function add()
{
	print_r ($this->params['data']);
        if (!empty($this->data) &&
is_uploaded_file($this->params['data']['Notiziak']['File']['tmp_name']))
        {
                $this->cleanUpFields();
                $fileName = $this->params['data']['Notiziak']['File']['name'];
                if(move_uploaded_file(
$this->params['data']['Model']['File']['tmp_name'],
WWW_ROOT.'files/'.$fileName))
                {
                        $this->Model->create();
                        $this->data['Model']['filename'] = $fileName;
                        if ($this->Model->Document->save($this->data)) {
                                $this->Session->setFlash('Archivo salvado');
                        }
                } else {
                        $this->Session->setFlash('Error: no se pudo guardar el archivo.');
                }
        } else {
                $this->Session->setFlash('Error: no se pudo leer el archivo.');
        }

}



VIEW

<?php print $html->file('Notiziak/imagina',NULL, TRUE); ?>