diff --git a/fileserver.go b/fileserver.go
index 6e03a08..2aa69ab 100644
--- a/fileserver.go
+++ b/fileserver.go
@@ -2254,7 +2254,7 @@ func (this *Server) SaveUploadFile(file multipart.File, header *multipart.FileHe
os.MkdirAll(folder, 0775)
}
outPath := fmt.Sprintf(folder+"/%s", fileInfo.Name)
- if Config().RenameFile {
+ if fileInfo.ReName != "" {
outPath = fmt.Sprintf(folder+"/%s", fileInfo.ReName)
}
if this.util.FileExists(outPath) && Config().EnableDistinctFile {
@@ -2344,6 +2344,7 @@ func (this *Server) upload(w http.ResponseWriter, r *http.Request) {
ok bool
// pathname string
md5sum string
+ fileName string
fileInfo FileInfo
uploadFile multipart.File
uploadHeader *multipart.FileHeader
@@ -2372,6 +2373,7 @@ func (this *Server) upload(w http.ResponseWriter, r *http.Request) {
}
if r.Method == http.MethodPost {
md5sum = r.FormValue("md5")
+ fileName = r.FormValue("filename")
output = r.FormValue("output")
if Config().ReadOnly {
w.Write([]byte("(error) readonly"))
@@ -2397,6 +2399,7 @@ func (this *Server) upload(w http.ResponseWriter, r *http.Request) {
}
}
fileInfo.Md5 = md5sum
+ fileInfo.ReName = fileName
fileInfo.OffSet = -1
if uploadFile, uploadHeader, err = r.FormFile("file"); err != nil {
log.Error(err)
@@ -3576,6 +3579,8 @@ func (this *Server) Index(w http.ResponseWriter, r *http.Request) {
场景(scene):
+ 文件名(filename):
+
输出(output):
自定义路径(path):
@@ -3601,7 +3606,8 @@ func (this *Server) Index(w http.ResponseWriter, r *http.Request) {
uppy.on('complete', (result) => {
// console.log(result) console.log('Upload complete! We’ve uploaded these files:', result.successful)
})
- uppy.setMeta({ auth_token: '9ee60e59-cb0f-4578-aaba-29b9fc2919ca',callback_url:'http://127.0.0.1/callback' })//这里是传递上传的认证参数,callback_url参数中 id为文件的ID,info 文转的基本信息json
+ //uppy.setMeta({ auth_token: '9ee60e59-cb0f-4578-aaba-29b9fc2919ca',callback_url:'http://127.0.0.1/callback' ,filename:'自定义文件名','path':'自定义path',scene:'自定义场景' })//这里是传递上传的认证参数,callback_url参数中 id为文件的ID,info 文转的基本信息json
+ uppy.setMeta({ auth_token: '9ee60e59-cb0f-4578-aaba-29b9fc2919ca',callback_url:'http://127.0.0.1/callback'})//自定义参数与普通上传类似(虽然支持自定义,建议不要自定义,海量文件情况下,自定义很可能给自已给埋坑)