diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/admin/upload/upload.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/system/admin/upload/upload.go b/system/admin/upload/upload.go index a0568e4..fd29796 100644 --- a/system/admin/upload/upload.go +++ b/system/admin/upload/upload.go @@ -31,11 +31,15 @@ func StoreFiles(req *http.Request) (map[string]string, error) { ts = fmt.Sprintf("%d", int64(time.Nanosecond)*time.Now().UnixNano()/int64(time.Millisecond)) // Unix() returns seconds since unix epoch } - req.Form.Set("timestamp", ts) - // To use for FormValue name:urlPath urlPaths := make(map[string]string) + if len(req.MultipartForm.File) == 0 { + return urlPaths, nil + } + + req.Form.Set("timestamp", ts) + // get or create upload directory to save files from request pwd, err := os.Getwd() if err != nil { |