当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUpload::getError方法代码示例

本文整理汇总了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());
 }
开发者ID:roydejong,项目名称:Enlighten,代码行数:9,代码来源:FileUploadTest.php

示例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");
开发者ID:davidgamarra,项目名称:DWESI_Practice4_UserManager,代码行数:31,代码来源:phpedituser.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();
 }
开发者ID:davidgamarra,项目名称:DWESI_Practice5_ArtGallery,代码行数:27,代码来源:Controller.php


注:本文中的FileUpload::getError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。