功能強大的php檔案上傳類

2022-10-06 06:03:08 字數 1694 閱讀 9115

<?php /*

*檔案上傳類

**/class upfile

//如果資料夾不存在則建立資料夾

function creatfolder($f_path)

}//判斷檔案是不是超過上傳限制

function is_big()

}//檢查檔案型別

function check_type()

}//檢查檔案是否存在

function check_file_name()

}//檢查是否有同名檔案,是否覆蓋

function check_same_file($filename)

}//移動檔案

function move_file($filename,$destination)

}//檢查檔案是否是通過 http post 上傳的

function is_upload_file()

}//獲得檔案程式設計客棧字尾名

function getext()

//新建檔名

function set_name()

//建立以年月日為資料夾名

function creat_mulu()

//生成的檔名

function files_name()

//上傳檔案

function upload_file()

//生成縮圖

//最大寬:120,高:120

function create_simg($img_w,$img_h)

$im = imagecreatefromgif($this->files_name());

break;

case 2:

if(!function_exists("imagecreatefromjpeg"))

$im = imagecreatefromjpeg($this->files_name());

break;

case 3:

$im = imagecreatefrompng($this->files_name());

break;

case 4:

$im = imagecreatefromwbmp($this->files_name());

break;

default:

die("is not filetype right");

exit;

}$src_w=imagesx($im);//獲得影象寬度

$src_h=imagesy($im);//獲得影象高度

$new_wh=($img_w/$img_h);//新影象寬與高的比值

$src_wh=($src_w/$src_h);//原影象寬與高的比值

if($new_wh<=$src_wh)else

if($src_w>$img_w||$src_h>$img_h)else

}else

if(function_exists('imagejpeg'))else

imagedestroy($new_img);

}//imagedestroy($new_img);

return $new_name;

}

}?>

本文標題: 功能強大的php檔案上傳類

本文位址: /wangluo/php/161958.html

功能強大的KSnapshot

ksnapshot是kde整合桌面環境自帶的截圖工具,不過在gnome整合桌面環境下也可以安裝和使用它。我們可以通過新立得軟體包管理器或使用apt get命令來安裝它。假設使用命令列方式來安裝,開啟乙個gnome終端視窗,在終端視窗中輸入如下命令 sudo apt get install ksnap...

功能強大的php後台管理系統

環境要求 php 7.0 pdo php extension mbstring php extension curl php extension 開啟靜態重寫 要求環境支援pathinfo 要求安裝zip擴充套件 外掛程式 模組市場需要 功能特性 嚴謹規範 提供一套有利於團隊協作的結構設計 編碼 資...

功能強大的SQL語句

1.複製表結構 sql 1.select into b from a where 1 0 select into b from a where 1 0 2.複製表記錄 複製某些字段 sql 1.insert into b a,b,c select d,e,f from a insert into b...