本文整理汇总了PHP中FileUpload::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::getName方法的具体用法?PHP FileUpload::getName怎么用?PHP FileUpload::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUpload
的用法示例。
在下文中一共展示了FileUpload::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FileUpload
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);
示例2: saveFile
/**
* 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;
}