diff options
author | Steve <nilslice@gmail.com> | 2016-11-02 02:27:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-02 02:27:29 -0700 |
commit | bd27ac1f0dbff856ca3e96d1df636f3b02d61522 (patch) | |
tree | be9b5b86b7da34a150e228a817335d368b8705ca /system/admin/upload/upload.go | |
parent | ac647e2f77d05cc015a369832c2d428ec1cd6567 (diff) | |
parent | 759506ca799c443402fed9c6413a8b49406e197f (diff) |
Merge pull request #12 from bosssauce/ponzu-dev
[core] More efficient DB queries
Diffstat (limited to 'system/admin/upload/upload.go')
-rw-r--r-- | system/admin/upload/upload.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/system/admin/upload/upload.go b/system/admin/upload/upload.go index 169bffe..323f371 100644 --- a/system/admin/upload/upload.go +++ b/system/admin/upload/upload.go @@ -45,7 +45,7 @@ func StoreFiles(req *http.Request) (map[string]string, error) { urlPathPrefix := "api" uploadDirName := "uploads" - uploadDir := filepath.Join(pwd, uploadDirName, fmt.Sprintf("%d", tm.Year()), fmt.Sprintf("%d", tm.Month())) + uploadDir := filepath.Join(pwd, uploadDirName, fmt.Sprintf("%d", tm.Year()), fmt.Sprintf("%02d", tm.Month())) err = os.MkdirAll(uploadDir, os.ModeDir|os.ModePerm) // loop over all files and save them to disk @@ -81,7 +81,7 @@ func StoreFiles(req *http.Request) (map[string]string, error) { } // add name:urlPath to req.PostForm to be inserted into db - urlPath := fmt.Sprintf("/%s/%s/%d/%d/%s", urlPathPrefix, uploadDirName, tm.Year(), tm.Month(), filename) + urlPath := fmt.Sprintf("/%s/%s/%d/%02d/%s", urlPathPrefix, uploadDirName, tm.Year(), tm.Month(), filename) urlPaths[name] = urlPath } |