本文整理汇总了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;
}
}
示例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;
}
}
}
}
示例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;
}
示例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;
}
}
}
}
示例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;
}
}
}
}