public function logoaddAction() { if ($this->request->hasFiles() == true) { foreach ($this->request->getUploadedFiles() as $file) { //Move the file into the application $carpeta = "file/clientes/"; $path = $carpeta . date("Ymd_his") . $file->getName(); if ($file->moveTo($path)) { $model = new Archivos(); $resul = $model->deleteImagenCliente($this->request->getPost('cliente_id')); $resul3 = new Archivos(); $resul3->producto_id = $this->request->getPost('cliente_id'); $resul3->tipo_archivo = $file->getType(); $resul3->nombre_archivo = date("Ymd_his") . $file->getName(); $resul3->carpeta = $carpeta; $resul3->tamanio = $file->getSize(); $resul3->usuario_reg = $this->_user->id; $resul3->fecha_reg = date("Y-m-d h:i:s"); $resul3->estado = 1; $resul3->baja_logica = 1; $resul3->tabla = 2; if ($resul3->save()) { $this->flashSession->success("Exito: Registro guardado correctamente..."); } else { $this->flashSession->error("Error: no se a guardado el registro..."); } } else { die("Acurrio algun error."); } } } $this->response->redirect('/clientes/view/' . $this->request->getPost('cliente_id')); }