echo Filtrar::isInt($mes); echo Filtrar::isInt($anio); echo Filtrar::isInt($Tipo_Id); if (Server::getRequestDate("Y") - $anio >= 14) { if ($dni == NULL || $dni == "") { echo "Documento de identidad obligatorio"; } } if (strlen($id_us) <= 8) { echo "Nº de Tarjeta Sanitaria: incorrecto"; } if ($dia < 1 || $dia > 31) { echo "Dias entre 1-31"; } if ($mes < 1 || $mes > 12) { echo "Mes entre 1-12"; } if (strlen($anio) < 4) { echo "Año debe tener 4 cifras"; } if (strlen($dni) < 9) { echo "DNI debe tenr nueve caracteres"; } $imagen = new FileUpload("archivo"); $imagen->setStore("img/"); $nombreOriginal = $imagen->getName(); $imagen->setName("_U_" . $usuario . "_X_" . $categoria . "_T_" . $privada . "_C_" . $nombreOriginal); $imagen->getPolicy(FileUpload::RENAME); $imagen->addType("gif"); $imagen->setSize(52428800); var_dump($imagen);
/** * Will save the image file as it is [If we only need to upload image without creating the thumbnails] * * @param file $file_element * @param string $module_name * @param integer $record_id * @param string $file_upload_path * @param string $filename */ public function saveFile($file_element, $module_name = "", $record_id, $file_upload_path, $is_main_resize = false, $is_thumbnail = false) { $fileObj = new FileUpload(); $fileObj->doInitialize($file_element); $filename = substr($file_element['name'], 0, strrpos($file_element['name'], '.')); $filename = $module_name . "_" . $record_id . $fileObj->getExtension(); $fileObj->setName($filename); $fileObj->saveAs($file_upload_path); //to save the file physically on given location $savedImgPath = $fileObj->getFullPath(); //This holds the full path of the file if ($is_main_resize) { $mainResize = PhpThumbFactory::create($savedImgPath); $mainResize->resize($this->mWidth, $this->mHeight); $mainResize->save($file_upload_path . $fileObj->getName()); } if ($is_thumbnail) { $thumb = PhpThumbFactory::create($savedImgPath); //$thumb->adaptiveResize(80, 80); $thumb->resize($this->mThumbWidth, $this->mThumbHeight); $thumb->save($file_upload_path . "thumbnail/" . $fileObj->getName()); } return $filename; }