forked from crony/UpFast
Server future uploaded files.
This commit is contained in:
parent
912f0049af
commit
d68add7803
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
upload
|
||||
env
|
||||
.env
|
||||
files
|
||||
|
14
main.go
14
main.go
@ -1,9 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
@ -19,6 +22,17 @@ func main() {
|
||||
|
||||
e.Static("/", "static")
|
||||
|
||||
files := "files"
|
||||
|
||||
if _, err := os.Stat(files); errors.Is(err, os.ErrNotExist) {
|
||||
err := os.Mkdir(files, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
e.Static("/files", files)
|
||||
|
||||
e.GET("/", Index)
|
||||
|
||||
e.Logger.Fatal(e.Start(":1323"))
|
||||
|
Loading…
Reference in New Issue
Block a user