aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorveradec <glitchmill.dyj3d@simplelogin.co>2026-11-11 13:14:08 +0530
committerveradec <glitchmill.dyj3d@simplelogin.co>2026-11-11 13:14:08 +0530
commitad2f596828f6f66e5c06be64497fab56b085dff5 (patch)
treed59f5ab0119da586a6c7e87fe8c5ca2845e6424e
init: basic file uploading works
-rw-r--r--go.mod36
-rw-r--r--main.go31
2 files changed, 67 insertions, 0 deletions
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..0ff3d70
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,36 @@
+module git.veradec.xyz/UxU
+
+go 1.27.2
+
+require (
+ github.com/bytedance/gopkg v0.1.3 // indirect
+ github.com/bytedance/sonic v1.15.0 // indirect
+ github.com/bytedance/sonic/loader v0.5.0 // indirect
+ github.com/cloudwego/base64x v0.1.6 // indirect
+ github.com/gabriel-vasile/mimetype v1.4.12 // indirect
+ github.com/gin-contrib/sse v1.1.0 // indirect
+ github.com/gin-gonic/gin v1.12.0 // indirect
+ github.com/go-playground/locales v0.14.1 // indirect
+ github.com/go-playground/universal-translator v0.18.1 // indirect
+ github.com/go-playground/validator/v10 v10.30.1 // indirect
+ github.com/goccy/go-json v0.10.5 // indirect
+ github.com/goccy/go-yaml v1.19.2 // indirect
+ github.com/json-iterator/go v1.1.12 // indirect
+ github.com/klauspost/cpuid/v2 v2.3.0 // indirect
+ github.com/leodido/go-urn v1.4.0 // indirect
+ github.com/mattn/go-isatty v0.0.20 // indirect
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+ github.com/modern-go/reflect2 v1.0.2 // indirect
+ github.com/pelletier/go-toml/v2 v2.2.4 // indirect
+ github.com/quic-go/qpack v0.6.0 // indirect
+ github.com/quic-go/quic-go v0.59.0 // indirect
+ github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
+ github.com/ugorji/go/codec v1.3.1 // indirect
+ go.mongodb.org/mongo-driver/v2 v2.5.0 // indirect
+ golang.org/x/arch v0.22.0 // indirect
+ golang.org/x/crypto v0.48.0 // indirect
+ golang.org/x/net v0.51.0 // indirect
+ golang.org/x/sys v0.41.0 // indirect
+ golang.org/x/text v0.34.0 // indirect
+ google.golang.org/protobuf v1.36.10 // indirect
+)
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..4e528df
--- /dev/null
+++ b/main.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "net/http"
+ "fmt"
+ "path/filepath"
+ "github.com/gin-gonic/gin"
+)
+
+func index(c *gin.Context){
+
+}
+
+func main(){
+ router := gin.Default()
+
+ router.POST("/", func(c *gin.Context) {
+ // single file
+ file, err := c.FormFile("file")
+ if err != nil {
+ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
+ return
+ }
+ fmt.Println(file.Filename)
+
+ dst := filepath.Join("./files/", filepath.Base(file.Filename))
+ c.SaveUploadedFile(file, dst)
+ c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!\n", file.Filename))
+ })
+ router.Run(":8080")
+}