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


PHP CUploadedFile::reset方法代码示例

本文整理汇总了PHP中CUploadedFile::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP CUploadedFile::reset方法的具体用法?PHP CUploadedFile::reset怎么用?PHP CUploadedFile::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUploadedFile的用法示例。


在下文中一共展示了CUploadedFile::reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetExtensionName

 public function testGetExtensionName()
 {
     $inputName = 'test_name';
     $_FILES[$inputName] = array('name' => 'test_file.dat', 'type' => 'somemime/type', 'tmp_name' => '/tmp/test_file', 'error' => UPLOAD_ERR_OK, 'size' => 100);
     $uploadedFile = CUploadedFile::getInstanceByName($inputName);
     $this->assertEquals("dat", $uploadedFile->getExtensionName(), 'Wrong extension name!');
     // reset and test a setup without file extension
     CUploadedFile::reset();
     $_FILES[$inputName]['name'] = 'test_file';
     $uploadedFile = CUploadedFile::getInstanceByName($inputName);
     $this->assertEquals("", $uploadedFile->getExtensionName(), 'Wrong extension name!');
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:12,代码来源:CUploadedFileTest.php

示例2: resetAndPopulateFilesArrayByFilePathAndName

 public static function resetAndPopulateFilesArrayByFilePathAndName($arrayName, $filePath, $fileName)
 {
     assert('is_string($arrayName) && $arrayName != ""');
     // Not Coding Standard
     assert('is_string($filePath)  && $filePath  != ""');
     // Not Coding Standard
     assert('is_string($fileName)  && $fileName  != ""');
     // Not Coding Standard
     $_FILES = null;
     CUploadedFile::reset();
     $_FILES = array($arrayName => array('name' => $fileName, 'type' => ZurmoFileHelper::getMimeType($filePath), 'tmp_name' => $filePath, 'error' => UPLOAD_ERR_OK, 'size' => filesize($filePath)));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:BaseTest.php

示例3: save

 public function save($runValidation = true, $attributes = NULL)
 {
     $class = get_class($this);
     if ($class == 'Accounts') {
         if (Accounts::model()->findByPk($this->id)) {
             $this->isNewRecord = false;
         }
     }
     $a = parent::save($runValidation, $attributes);
     if ($a) {
         //if (isset($_POST['Files'])) {
         //$this->attributes = $_POST['Files'];
         $tmps = CUploadedFile::getInstancesByName('Files');
         // proceed if the images have been set
         if (isset($tmps) && count($tmps) > 0) {
             Yii::log('saved', 'info', 'app');
             // go through each uploaded image
             $configPath = Yii::app()->user->settings["company.path"];
             foreach ($tmps as $image => $pic) {
                 $img_add = new Files();
                 $img_add->name = $pic->name;
                 //it might be $img_add->name for you, filename is just what I chose to call it in my model
                 $img_add->path = "files/";
                 $img_add->parent_type = get_class($this);
                 $img_add->parent_id = $this->id;
                 // this links your picture model to the main model (like your user, or profile model)
                 $img_add->save();
                 // DONE
                 if ($pic->saveAs($img_add->getFullFilePath())) {
                     // add it to the main model now
                 } else {
                     echo 'Cannot upload!';
                 }
             }
             if (isset($_FILES)) {
                 Yii::log(print_r($_FILES, true), 'info', 'app');
                 unset($_FILES);
                 $tmps = CUploadedFile::reset();
             }
             //}
         }
     }
     //endFile
     return $a;
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:45,代码来源:fileRecord.php

示例4: setUp

 public function setUp()
 {
     $_FILES = array();
     CUploadedFile::reset();
 }
开发者ID:motin,项目名称:forked-php-orm-benchmark,代码行数:5,代码来源:CUploadedFileTest.php


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