本文整理匯總了PHP中UploadFile::setName方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadFile::setName方法的具體用法?PHP UploadFile::setName怎麽用?PHP UploadFile::setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UploadFile
的用法示例。
在下文中一共展示了UploadFile::setName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: UploadFile
$nombre_tipado = $privado . '_' . $usuario . '_' . $categoria . '_' . $cancion->getName();
if ($cancion->getError() === UPLOAD_ERR_OK && $cancion->getExt() === "mp3") {
$cancion->setName($nombre_tipado);
if (!$cancion->upload()) {
echo "<h2>Error: " . $cancion->getError_message() . "</h2>";
echo $cancion;
} else {
echo "<h2>Error: " . $cancion->getError_message() . "</h2>";
}
} else {
echo "<h2>No ha llegado ninguna cancion: " . $cancion->getError_message() . "</h2>";
}
if (isset($_FILES['img'])) {
$imagen = new UploadFile($_FILES['img']);
if ($imagen->getError() === UPLOAD_ERR_OK && $imagen->getExt() === "jpg") {
$imagen->setName($nombre_tipado);
if (!$imagen->upload()) {
echo "<h2>Error: " . $imagen->getError_message() . "</h2>";
}
} else {
echo "<h2>Error: " . $imagen->getError_message() . "</h2>";
}
} else {
echo "<h2>No ha subido ninguna imagen</h2>";
}
} else {
echo "<h2>No ha subido ninguna canción</h2>";
}
} else {
echo "EEEEEEEEEEEEEEEEEEEE";
}
示例2: multiUpload
static function multiUpload($files, $destination = null, $name = null)
{
$result = array();
if (self::isMultiFile($files)) {
$arrayFiles = self::normalizeArray($files);
$i = 0;
foreach ($arrayFiles as $value) {
$tmp = new UploadFile($value);
if ($destination !== null) {
$tmp->setDestination($destination);
}
if ($name !== null) {
$tmp->setName($name);
}
$tmp->upload();
$cod = $tmp->getError();
$errMsg = $tmp->getError_message();
$arrayRes = array($cod, $errMsg, $tmp->getDestination(), $tmp->getName() . '.' . $tmp->getExt(), $value['name']);
array_push($result, $arrayRes);
}
} else {
$tmp = new UploadFile($files);
if ($destination !== null) {
$tmp->setDestination($destination);
}
if ($name !== null) {
$tmp->setName($name);
}
$tmp->upload();
$cod = $tmp->getError();
$errMsg = $tmp->getError_message();
$arrayRes = array($cod, $errMsg, $tmp->getDestination(), $tmp->getName() . '.' . $tmp->getExt(), $value['name']);
array_push($result, $arrayRes);
}
return $result;
}
示例3: UploadFile
$r = $mng->toogleActive(Request::req('pkid'));
} else {
$r = "no-tiene-permiso-para-realizar-la-acción";
}
break;
case 'changePass':
if ($secLevel != 0) {
$mng->userChangePass();
} else {
$r = "no-tiene-permiso-para-realizar-la-acción";
}
break;
case 'uploadImage':
if ($secLevel != 0) {
$file = new UploadFile($_FILES['image']);
$file->setName(Request::req('pkid'));
$file->setDestination('../img/profiles/');
$file->upload();
$r = $file->getError_message();
Utils::Redirect('./admin.php?op=' . $op . '&r=' . $r);
} else {
$r = "no-tiene-permiso-para-realizar-la-acción";
}
break;
case 'reactive':
$mng->send_activation_mail(Request::req('pkid'));
break;
default:
$r = 'op-error';
}
Utils::Redirect('./admin.php?op=' . $op . '&r=' . $r);