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


PHP HTTPRequest::fileExists方法代码示例

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


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

示例1: executeAvatar

 public function executeAvatar(HTTPRequest $request)
 {
     ini_set("memory_limit", '256M');
     $this->page->smarty()->assign('avatar', $this->_profilePro->getAvatar());
     if ($request->fileExists('avatar')) {
         $avatar = $request->fileData('avatar');
         if ($avatar['error'] == 0) {
             $simpleImage = new SimpleImage();
             $simpleImage->load($avatar['tmp_name']);
             if (!is_null($simpleImage->image_type)) {
                 $height = $simpleImage->getHeight();
                 $width = $simpleImage->getWidth();
                 if ($height > $width) {
                     $simpleImage->resizeToHeight(150);
                 } else {
                     $simpleImage->resizeToWidth(150);
                 }
                 $filename = time() . '.jpg';
                 $simpleImage->save($_SERVER['DOCUMENT_ROOT'] . $this->_userDir . $filename);
                 if ($this->_profilePro->getAvatar() != ProfilePro::AVATAR_DEFAULT_PRO) {
                     unlink($_SERVER['DOCUMENT_ROOT'] . $this->_profilePro->getAvatar());
                 }
                 $this->_profilePro->setAvatar($this->_userDir . $filename);
                 $this->_profileProManager->save($this->_profilePro);
                 $this->app->user()->setFlash('avatar-updated');
             } else {
                 $this->app->user()->setFlash('avatar-error');
             }
         } else {
             $this->app->user()->setFlash('avatar-error');
         }
         $this->app->httpResponse()->redirect('/profile-pro');
     }
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:34,代码来源:ProfileproController.class.php

示例2: parsePhoto

 private function parsePhoto(HTTPRequest $request, AnnouncementPro $announce)
 {
     ini_set("memory_limit", '512M');
     if ($request->fileExists('photo-main')) {
         $photoMain = $request->fileData('photo-main');
         $this->savePhoto($announce, 'PhotoMain', $photoMain);
     }
     if ($request->fileExists('photo-option-1')) {
         $photoOption1 = $request->fileData('photo-option-1');
         $this->savePhoto($announce, 'PhotoOption1', $photoOption1);
     }
     if ($request->fileExists('photo-option-2')) {
         $photoOption2 = $request->fileData('photo-option-2');
         $this->savePhoto($announce, 'PhotoOption2', $photoOption2);
     }
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:16,代码来源:AnnouncementsproController.class.php

示例3: parsePhoto

 private function parsePhoto(HTTPRequest $request, Announcement $announce)
 {
     ini_set("memory_limit", '512M');
     if ($request->postExists('delete-photo-main')) {
         unlink(MediaImage::getAnnounceDirectory($announce) . '/' . $announce->getPhotoMain());
         unlink(MediaImage::getAnnounceDirectory($announce) . '/' . Announcement::THUMBNAILS_PREFIX . $announce->getPhotoMain());
         $announce->setPhotoMain('');
     }
     if ($request->postExists('delete-photo-option-1')) {
         unlink(MediaImage::getAnnounceDirectory($announce) . '/' . $announce->getPhotoOption1());
         unlink(MediaImage::getAnnounceDirectory($announce) . '/' . Announcement::THUMBNAILS_PREFIX . $announce->getPhotoOption1());
         $announce->setPhotoOption1('');
     }
     if ($request->postExists('delete-photo-option-2')) {
         unlink(MediaImage::getAnnounceDirectory($announce) . '/' . $announce->getPhotoOption2());
         unlink(MediaImage::getAnnounceDirectory($announce) . '/' . Announcement::THUMBNAILS_PREFIX . $announce->getPhotoOption2());
         $announce->setPhotoOption2('');
     }
     if ($request->fileExists('photo-main')) {
         $photoMain = $request->fileData('photo-main');
         $this->savePhoto($announce, 'PhotoMain', $photoMain);
     }
     if ($request->fileExists('photo-option-1')) {
         $photoOption1 = $request->fileData('photo-option-1');
         $this->savePhoto($announce, 'PhotoOption1', $photoOption1);
     }
     if ($request->fileExists('photo-option-2')) {
         $photoOption2 = $request->fileData('photo-option-2');
         $this->savePhoto($announce, 'PhotoOption2', $photoOption2);
     }
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:31,代码来源:AnnouncementsController.class.php


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