整个包结构重构
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package download
|
||||
|
||||
import (
|
||||
. "../../common"
|
||||
"bytes"
|
||||
"code.hoteas.com/golang/hotime"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
func Down(url, path, name string) bool {
|
||||
|
||||
os.MkdirAll(path, os.ModeDir)
|
||||
if hotime.Substr(path, len(path)-1, len(path)) != "/" {
|
||||
if Substr(path, len(path)-1, len(path)) != "/" {
|
||||
path = path + "/"
|
||||
}
|
||||
out, err := os.Create(path + name)
|
||||
e := hotime.Error{}
|
||||
e := Error{}
|
||||
if err != nil {
|
||||
e.SetError(err)
|
||||
return false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package upload
|
||||
|
||||
import (
|
||||
"code.hoteas.com/golang/hotime"
|
||||
. "../../common"
|
||||
"errors"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
@@ -50,7 +50,7 @@ func (this *Upload) UpFile(Request *http.Request, fieldName, savefilepath, saveP
|
||||
}
|
||||
}
|
||||
}
|
||||
filename := time.Unix(int64(t), 0).Format("2006-01-02-15-22-25") + hotime.ObjToStr(hotime.Rand(6))
|
||||
filename := time.Unix(int64(t), 0).Format("2006-01-02-15-22-25") + ObjToStr(Rand(6))
|
||||
filePath = path + "/" + filename + this.Path
|
||||
} else {
|
||||
filePath = savePath
|
||||
|
||||
Reference in New Issue
Block a user