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


PHP Uploader::Upload方法代码示例

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


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

示例1: changeAvatar

 function changeAvatar()
 {
     if (isset($_POST['avasubmit'])) {
         $upload_dir = './images/avatars/';
         $cfile = md5($_SESSION['nickname']);
         $u = new Uploader();
         try {
             if (is_file($upload_dir . $cfile . '.jpg')) {
                 unlink($upload_dir . $cfile . '.jpg');
             }
             if (is_file($upload_dir . $cfile . '.jpeg')) {
                 unlink($upload_dir . $cfile . '.jpeg');
             }
             if (is_file($upload_dir . $cfile . '.png')) {
                 unlink($upload_dir . $cfile . '.png');
             }
             if (is_file($upload_dir . $cfile . '.gif')) {
                 unlink($upload_dir . $cfile . '.gif');
             }
             $cfile = $u->Upload('avach', $upload_dir, $cfile);
         } catch (Exception $e) {
             $error = $e->getMessage();
         }
         $sql = "UPDATE useravatar SET avatar='" . $cfile . "' WHERE id=(SELECT avatar_id FROM users WHERE id=" . $_SESSION['id'] . ");";
         $this->db->query($sql);
         $_SESSION['avatar'] = $cfile;
     }
 }
开发者ID:dicksel,项目名称:ShitPress,代码行数:28,代码来源:personal.php

示例2: upload

 function upload(&$file, $path = 'uploads/', $width = FALSE, $height = FALSE, $ratio = FALSE)
 {
     if ($file['name']) {
         ini_set("max_execution_time", "600");
         ini_set("memory_limit", "12M");
         $this->filename = uniqid();
         $this->load->library('uploader');
         $handle = new Uploader();
         $handle->Upload($file);
         $handle->allowed = array('image/jpeg', 'image/jpg', 'image/gif', 'image/png', 'image/bmp', 'application/pdf');
         $this->handle =& $handle;
         if ($width) {
             return $this->thumb($path, $width, $height, $ratio);
         } else {
             $this->handle->file_new_name_body = $this->filename;
             $this->handle->process($path);
             if ($this->handle->processed) {
                 return $this->handle->file_dst_name;
             }
         }
     }
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:22,代码来源:ORM.php

示例3: Upload

 /**
  * Crida la funció de pujada del pare
  * i una vegada completat el procés, si l'usuari ho vol
  * redimensiona les imatges pujades. 
  * 
  */
 function Upload()
 {
     $uploaded = parent::Upload();
     if (!$uploaded) {
         echo 'Error upload image';
     } else {
         if ($this->conf['thumb']) {
             $this->createThumbs($uploaded);
         }
     }
     return $uploaded;
 }
开发者ID:jherediagu,项目名称:krang_framework,代码行数:18,代码来源:Uploader.php

示例4: upload

 function upload(&$file, $path = 'uploads/', $resize = FALSE, $width = FALSE, $height = FALSE, $ratio = FALSE)
 {
     if ($file['name']) {
         ini_set("max_execution_time", "600");
         ini_set("memory_limit", "12M");
         $this->load->library('uploader');
         $handle = new Uploader();
         $handle->Upload($file);
         $this->handle =& $handle;
         if ($resize) {
             return $this->thumb($path, $width, $height, $ratio);
         } else {
             $this->handle->process($path);
             if ($this->handle->processed) {
                 return $this->handle->file_dst_name;
             }
         }
     }
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:19,代码来源:MY_Model.php

示例5: upload

 function upload(&$file, $path = 'uploads/', $width = FALSE, $height = FALSE, $ratio = FALSE)
 {
     if ($file['name']) {
         ini_set("max_execution_time", "600");
         ini_set("memory_limit", "-1");
         $this->filename = uniqid();
         $this->load->library('uploader');
         $handle = new Uploader();
         $handle->Upload($file);
         $this->handle =& $handle;
         if (!empty($this->watermark['image'])) {
             $this->handle->image_watermark = 'uploads/watermark/' . $this->watermark['image'];
             $this->handle->image_watermark_position = $this->watermark['position'];
         }
         if ($width) {
             return $this->thumb($path, $width, $height, $ratio);
         } else {
             $this->handle->file_new_name_body = $this->filename;
             $this->handle->process($path);
             if ($this->handle->processed) {
                 return $this->handle->file_dst_name;
             }
         }
     }
 }
开发者ID:unisexx,项目名称:adf16,代码行数:25,代码来源:ORM.php


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