make files dir if it doesn't exist
This commit is contained in:
parent
cb270d1e16
commit
c5b8dbdedd
5
main.go
5
main.go
@ -276,6 +276,11 @@ func main() {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Create the files directory if it doesn't already exist
|
||||||
|
if _, err := os.Stat(conf.FileFolder); os.IsNotExist(err) {
|
||||||
|
os.Mkdir(conf.FileFolder, 0755)
|
||||||
|
}
|
||||||
|
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/", UploadHandler).Methods("POST")
|
r.HandleFunc("/", UploadHandler).Methods("POST")
|
||||||
r.HandleFunc("/uploads/{name}", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/uploads/{name}", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user