本文整理汇总了PHP中FileUpload::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::getError方法的具体用法?PHP FileUpload::getError怎么用?PHP FileUpload::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUpload
的用法示例。
在下文中一共展示了FileUpload::getError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetSetError
public function testGetSetError()
{
$file = new FileUpload();
$this->assertEquals(UPLOAD_ERR_OK, $file->getError(), 'Default is ERR_OK');
$this->assertFalse($file->hasError(), 'ERR_OK is not an error');
$this->assertEquals($file, $file->setError(UPLOAD_ERR_INI_SIZE), 'Fluent API');
$this->assertEquals(UPLOAD_ERR_INI_SIZE, $file->getError());
$this->assertTrue($file->hasError());
}
示例2: ManageUser
$userManager = new ManageUser($db);
$sesion = new Session();
$email = Request::post("email");
$newemail = Request::post("newemail");
$pass = Request::post("pass");
$alive = Request::post("alive");
$worker = Request::post("worker");
$admin = Request::post("admin");
$newemail = $newemail === null ? $email : $newemail;
$alive = $alive === null ? 0 : 1;
$worker = $worker === null ? 0 : 1;
$admin = $admin === null ? 0 : 1;
$usuario = $userManager->get($email);
$usuario->setEmail($newemail);
$usuario->setAlias(explode("@", $newemail)[0]);
$usuario->setAlive($alive);
$usuario->setWorker($worker);
$usuario->setAdmin($admin);
if ($pass !== null) {
$usuario->setPass($pass);
}
$photo = new FileUpload("image");
if ($photo->getError() === false) {
$usuario->setImage("images/" . $usuario->getAlias() . ".jpg");
$photo->setDestination("../images/");
$photo->setName($usuario->getAlias());
echo $photo->upload();
}
$userManager->setEmail($usuario, $email);
$sesion->destroy();
$sesion->sendRedirect("../admin.php");
示例3: insertArt
private static function insertArt()
{
$sesion = new Session();
if ($sesion->isLogged()) {
$db = new DataBase();
$manager = new ManageArt($db);
$managerUser = new ManageUser($db);
$email = Request::post("email");
$title = Request::post("title");
$usuario = $managerUser->get($email);
$art = new Art();
$art->setEmail($email);
$art->setTitle($title);
$art->setCdate(date('Y-m-d G:i:s'));
$fecha = date('_Y_m_d_G_i_s');
$photo = new FileUpload("image");
if ($photo->getError() === false) {
$art->setImage("./resources/art/" . $usuario->getAlias() . $fecha . ".jpg");
$photo->setDestination("./resources/art/");
$photo->setName($usuario->getAlias() . $fecha);
$photo->upload();
}
$manager->insert($art);
$db->close();
}
self::viewProfile();
}