#引入上傳物件
include_once WEB_PATH."/class/ugmUpFiles.php";
```
2. 「表單」取代原先上傳的程式碼(會自動建立資料夾)
admin\_prod.php -> opForm() ```
#----單檔圖片上傳
$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);
#-----------------------------------
```
3. 「樣板」取代原樣板 ```
```
4. 新增商品
admin\_prod.php -> opInsert()
```
#----單圖上傳
$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);
#------------------------------------------------
```
5. 更新商品
admin\_prod.php -> opUpdate($sn) ```
#----單圖上傳
$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);
#------------------------------------------------
```
6. 刪除商品
```
#----單圖
$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();//刪除檔案
#------------------------------------------------
```
7.