<?php class upload { var $dir; //附件存放物理目錄 var $time; //自定義文件上傳時(shí)間 var $allow_types; //允許上傳附件類型 var $field; //上傳控件名稱 var $maxsize; //最大允許文件大小,單位為KB var $thumb_width; //縮略圖寬度 var $thumb_height; //縮略圖高度 var $watermark_file; //水印圖片地址 var $watermark_pos; //水印位置 var $watermark_trans;//水印透明度 //構(gòu)造函數(shù) //$types : 允許上傳的文件類型 , $maxsize : 允許大小 , $field : 上傳控件名稱 , $time : 自定義上傳時(shí)間 function upload($types = 'jpg|png', $maxsize = 1024, $field = 'attach', $time = '') { $this->allow_types = explode('|',$types); $this->maxsize = $maxsize * 1024; $this->field = $field; $this->time = $time ? $time : time(); } //設(shè)置并創(chuàng)建文件具體存放的目錄 //$basedir : 基目錄,必須為物理路徑 //$filedir : 自定義子目錄,可用參數(shù){y}、{m}、377j5v51b function set_dir($basedir,$filedir = '') { $dir = $basedir; !is_dir($dir) && @mkdir($dir,0777); if (!empty($filedir)) { $filedir = str_replace(array('{y}','{m}','377j5v51b'),array(date('Y',$this->time),date('m',$this->time),date('d',$this->time)),strtolower($filedir));//用string_replace把{y} {m} 377j5v51b幾個(gè)標(biāo)簽進(jìn)行替換 $dirs = explode('/',$filedir); foreach ($dirs as $d) { !empty($d) && $dir .= $d.'/'; !is_dir($dir) && @mkdir($dir,0777); } } $th
PHP multi-file upload class that supports watermarks, dates, and thumbnails. Set and create the directory where the files are stored. Picture thumbnail settings. If thumbnails are not generated, no settings are needed. Picture watermark settings. If no watermarks are generated, add watermarks. There is no need to set it, file upload is performed, and after processing, an array of file information containing successful or failed upload is returned.
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article

13 Dec 2024
Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

28 Oct 2024
Suppression of Tensorflow Debugging OutputTensorflow prints extensive information about loaded libraries, found devices, and other debugging data...

03 Jan 2025
Overflow: Hidden and Expansion of HeightjQuery distinguishes itself from other JavaScript libraries through its cross-platform compatibility and...

30 Oct 2024
Native Java Image Processing Libraries for High-Quality ResultsAs you have encountered limitations with ImageMagick and JAI, let's explore other...

24 Oct 2024
This article guides developers on crafting static libraries in C using g . It demonstrates how to compile source code into object files, create static libraries, and incorporate them into other projects. By leveraging this approach, developers can

27 Dec 2024
Executing Command Line Binaries in Node.jsExecuting third-party binaries is an essential task when porting CLI libraries from other languages to...


Hot Tools

PHP library for dependency injection containers
PHP library for dependency injection containers

A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking

Small PHP library for optimizing images
Small PHP library for optimizing images
