一、安裝
二、使用
#引入上傳物件 include_once WEB_PATH."/class/ugmUpFiles.php";
#----單檔圖片上傳 $moduleName = "ugm_p"; //專案名稱 $col_name = "prod";//資料表關鍵字 $col_sn = $row['sn'];//商品流水號 $name = "pic";//欄位名稱 $subdir = $col_name."/".$name; //子目錄 $multiple = false;//單檔 or 多檔上傳 $ugmUpFiles = new ugmUpFiles($moduleName, $subdir);//實體化 $accept = "image/*"; //可接受副檔名 $row['pic'] = $ugmUpFiles->upform($name,$col_name,$col_sn,$multiple,$accept); #-----------------------------------
<div class="col-sm-3"> <div class="form-group"> <label for="pic">圖片<span>(800x449)</span></label> <{$row.pic}> </div> </div>
#----單圖上傳 $moduleName = "ugm_p"; //專案名稱 $col_name = "prod"; //資料表關鍵字 $col_sn = $sn; //商品流水號 $name = "pic"; //欄位名稱 $subdir = $col_name."/".$name; //子目錄 $multiple = false; //單檔 or 多檔上傳 $main_width = "1280"; //大圖壓縮尺吋,-1則不壓縮 $thumb_width = "120"; //小圖壓縮尺吋 $ugmUpFiles = new ugmUpFiles($moduleName, $subdir); $ugmUpFiles->upload_file($name,$col_name,$col_sn,$multiple,$main_width,$thumb_width); #------------------------------------------------
#----單圖上傳 $moduleName = "ugm_p"; //專案名稱 $col_name = "prod"; //資料表關鍵字 $col_sn = $sn; //商品流水號 $name = "pic"; //欄位名稱 $subdir = $col_name."/".$name; //子目錄 $multiple = false; //單檔 or 多檔上傳 $main_width = "1280"; //大圖壓縮尺吋,-1則不壓縮 $thumb_width = "120"; //小圖壓縮尺吋 $ugmUpFiles = new ugmUpFiles($moduleName, $subdir); $ugmUpFiles->upload_file($name,$col_name,$col_sn,$multiple,$main_width,$thumb_width); #------------------------------------------------
#----單圖 $moduleName = "ugm_p"; //專案名稱 $col_name = "prod"; //資料表關鍵字 $col_sn = $sn; //商品流水號 $name = "pic"; //欄位名稱 $subdir = $col_name."/".$name; //子目錄 $multiple = false; //單檔 or 多檔上傳 $ugmUpFiles = new ugmUpFiles($moduleName, $subdir); //實體化 $ugmUpFiles->set_col($col_name,$col_sn);//指定處理標的 $ugmUpFiles->del_files();//刪除檔案 #------------------------------------------------