No changes made

This commit is contained in:
2025-04-16 12:47:04 -04:00
commit 1ed3b0c2d4
98 changed files with 8857 additions and 0 deletions

29
backend/handlers/file.go Normal file
View File

@@ -0,0 +1,29 @@
package handlers
import (
"github.com/labstack/echo/v4"
"net/http"
)
func ReadFile(c echo.Context, formName string) ([]byte, error) {
file, err := c.FormFile(formName)
if err != nil {
c.Logger().Error(err)
_ = c.JSON(http.StatusBadRequest, struct {
Message string `json:"message"`
}{
Message: "No file provided",
})
return nil, err
}
handler, err := file.Open()
if err != nil {
return nil, err
}
buf := make([]byte, file.Size)
_, _ = handler.Read(buf)
return buf, nil
}