liuxiaolong
2019-09-19 0182b6c3f5cba55379eff58c4a1dad280ef152c2
WeedFSClient.go
@@ -6,7 +6,6 @@
   "errors"
   "fmt"
   "io"
   "log"
   "mime/multipart"
   "net/http"
   "time"
@@ -32,7 +31,7 @@
   client := &http.Client{Timeout: timeout}
   resp, err := client.Do(request)
   if err != nil {
      log.Fatal(err)
      fmt.Println("UploadFile client.Do(request) err:", err)
      return "", err
   }
   defer func() {
@@ -55,7 +54,7 @@
      body := &bytes.Buffer{}
      _, err := body.ReadFrom(resp.Body)
      if err != nil {
         log.Fatal(err)
         fmt.Println("UploadFile body.ReadForm(resp.Body) err:", err)
      }
      m := make(map[string]interface{})
@@ -64,12 +63,5 @@
      }
      filePath := m["fileUrl"].(string)
      return filePath,nil
      //if strings.Contains(filePath,"/"){
      //   idx := strings.Index(filePath,"/")
      //   filePath = filePath[idx+1:]
      //   return filePath,nil
      //} else {
      //   return "",errors.New("file upload error")
      //}
   }
}