mirror of
https://gitee.com/sjqzhang/go-fastdfs.git
synced 2024-11-30 02:07:45 +08:00
Update fileserver.go
This commit is contained in:
parent
ae9baab679
commit
dcc3dcfbc9
@ -499,6 +499,13 @@ func (this *Server) Upload(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
md5sum = util.GetFileMd5(uploadFile)
|
||||
|
||||
if info, _ := this.GetFileInfoByMd5(md5sum); info != nil && info.Path != "" && info.Path != folder {
|
||||
os.Remove(folder + "/" + name)
|
||||
download_url := fmt.Sprintf("http://%s/%s", r.Host, info.Path+"/"+info.Name)
|
||||
w.Write([]byte(download_url))
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
v := util.GetFileMd5(uploadFile)
|
||||
|
Loading…
Reference in New Issue
Block a user