Skip to content

Commit

Permalink
chore(file): Creates a directory named path (#3316)
Browse files Browse the repository at this point in the history
Co-authored-by: mohanak <mohanak@mkcl.org>
  • Loading branch information
mskKandula and mohanak committed Oct 16, 2022
1 parent 24a1d2a commit 45c758e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions context.go
Expand Up @@ -15,6 +15,7 @@ import (
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -601,6 +602,10 @@ func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error
}
defer src.Close()

if err = os.MkdirAll(filepath.Dir(dst), 0750); err != nil {
return err
}

out, err := os.Create(dst)
if err != nil {
return err
Expand Down

0 comments on commit 45c758e

Please sign in to comment.