<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ~~~ <?PHP /* *文件上傳類 **/ $upFile = new upfile('name'); $up = $upFile->upload_file(); var_dump($up); class upfile { private $file_size;//上傳源文件大小 private $file_tem;//上傳文件臨時儲存名 private $file_name;//上傳文件名 private $file_type;//上傳文件類型 private $file_max_size = 2000000;//允許文件上傳最大 private $file_folder = "uploadFiles";//文件上傳路徑 private $over_write = false;//是否覆蓋同名文件 //允許上傳圖片的類型 private $allow_type = array( 'image/jpg', 'image/jpeg', 'image/png', 'image/pjpeg', 'image/gif', 'image/bmp', 'image/x-png' ); //構造類,file:上傳文件域 function __construct($file) { $this->file_name = $_FILES[$file]['name'];//客戶端原文件名 $this->file_type = $_FILES[$file]['type'];//文件類型 $this->file_tem = $_FILES[$file]['tmp_name'];//儲存的臨時文件名,一般是系統默認 $this->file_size = $_FILES[$file]['size'];//文件大小 } //如果文件夾不存在則創建文件夾 function creatFolder($f_path) { if ( ! file_exists($f_path)) { mkdir($f_path, 0777); } } //判斷文件是不是超過上傳限制 function is_big() { if ($this->file_size > $this->file_max_size) { echo "文件太大,超過限制!"; exit; } } //檢查文件類型 function check_type() { if ( ! in_array($this->file_type, $this->allow_type)) { echo "上傳文件類型不正確"; exit; } } //檢查文件是否存在 function check_file_name() { if ( ! file_exists($this->file_tem)) { echo "上傳文件不存在"; exit; } } //檢查是否有同名文件,是否覆蓋 function check_same_file($filename) { if (file_exists($filename) && $this->over_write != true) { echo "同名文件已存在!"; exit; } } //移動文件 function move_file($filename, $destination) { if ( ! move_uploaded_file($filename, $destination)) { echo "移動文件出錯"; exit; } } //檢查文件是否是通過 HTTP POST 上傳的 function is_upload_file() { if ( ! is_uploaded_file($this->file_tem)) { echo "文件不存在"; exit; } } //獲得文件后綴名 function getext() { $ext = $this->file_name; $extstr = explode('.', $ext); $count = count($extstr) - 1; return $extstr[$count]; } //新建文件名 function set_name() { return time().".".$this->getext(); } //建立以年月日為文件夾名 function creat_mulu() { $this->creatFolder("uploads/".date('Ymd')); return "uploads/".date('Ymd'); } //生成的文件名 function files_name() { $dir = dirname(__FILE__).DIRECTORY_SEPARATOR; $name = $this->set_name(); $folder = $this->creat_mulu(); return $folder."/".$name; } //上傳文件 function upload_file() { $f_name = $this->files_name(); @move_uploaded_file($this->file_tem, $f_name); return '/'.$f_name; } //生成縮略圖 //最大寬:120,高:120 function create_simg($img_w, $img_h) { $name = $this->set_name(); $folder = $this->creat_mulu(); $new_name = "../../".$folder."/s_".$name; $imgsize = getimagesize($this->files_name()); switch ($imgsize[2]) { case 1: if ( ! function_exists("imagecreatefromgif")) { echo "你的GD庫不能使用GIF格式的圖片,請使用Jpeg或PNG格式!返回"; exit(); } $im = imagecreatefromgif($this->files_name()); break; case 2: if ( ! function_exists("imagecreatefromjpeg")) { echo "你的GD庫不能使用jpeg格式的圖片,請使用其它格式的圖片!返回"; exit(); } $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) { $f_w = $img_w; $f_h = $f_w * ($src_h / $src_w); } else { $f_h = $img_h; $f_w = $f_h * ($src_w / $src_h); } if ($src_w > $img_w || $src_h > $img_h) { if (function_exists("imagecreatetruecolor")) {//檢查函數是否已定義 $new_img = imagecreatetruecolor($f_w, $f_h); if ($new_img) { imagecopyresampled($new_img, $im, 0, 0, 0, 0, $f_w, $f_h, $src_w, $src_h);//重采樣拷貝部分圖像并調整大小 } else { $new_img = imagecreate($f_w, $f_h); imagecopyresized($new_img, $im, 0, 0, 0, 0, $f_w, $f_h, $src_w, $src_h); } } else { $$new_img = imagecreate($f_w, $f_h); imagecopyresized($new_img, $im, 0, 0, 0, 0, $f_w, $f_h, $src_w, $src_h); } if (function_exists('imagejpeg')) { imagejpeg($new_img, $new_name); } else { imagepng($new_img, $new_name); } imagedestroy($new_img); } //imagedestroy($new_img); return $new_name; } } ?> ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看