chore(file): Creates a directory named path (#3316)

Co-authored-by: mohanak <mohanak@mkcl.org>
This commit is contained in:
Mohana sai krishna Kandula 2022-10-16 07:15:08 +05:30 committed by GitHub
parent 24a1d2adb9
commit 45c758e2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"path/filepath"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -601,6 +602,10 @@ func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error
} }
defer src.Close() defer src.Close()
if err = os.MkdirAll(filepath.Dir(dst), 0750); err != nil {
return err
}
out, err := os.Create(dst) out, err := os.Create(dst)
if err != nil { if err != nil {
return err return err