Browse Source

add image delete

zjxpcyc 6 years ago
parent
commit
4a8e3a3eed
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      controllers/wechatimg/wechatimt.go

+ 2
- 0
controllers/wechatimg/wechatimt.go View File

@@ -143,6 +143,8 @@ func (c *WechatImgController) AddNewImg() {
143 143
 	defer file.Close()
144 144
 
145 145
 	imgurl := "./upload/" + head.Filename
146
+	defer os.Remove(imgurl)
147
+
146 148
 	//创建文件
147 149
 	fW, err := os.Create(imgurl)
148 150
 	if err != nil {