mirror of
https://github.com/Expand-sys/goenemy
synced 2025-12-15 21:42:22 +11:00
nothing working yet but making small progress
This commit is contained in:
parent
bd9b428ff8
commit
ec27b01403
2 changed files with 32 additions and 13 deletions
23
main.go
23
main.go
|
|
@ -4,8 +4,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/disintegration/imaging"
|
"github.com/disintegration/imaging"
|
||||||
"github.com/fogleman/gg"
|
"github.com/fogleman/gg"
|
||||||
|
|
@ -25,13 +27,28 @@ func routeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func formHandler(w http.ResponseWriter, r *http.Request) {
|
func formHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if err := r.ParseMultipartForm(2048); err != nil {
|
file, handler, err := r.FormFile("file")
|
||||||
|
fileName := r.FormValue("file_name")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
f, err := os.OpenFile(handler.Filename, os.O_WRONLY|os.O_CREATE, 0666)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
_, _ = io.WriteString(w, "File "+fileName+" Uploaded successfully")
|
||||||
|
_, _ = io.Copy(f, file)
|
||||||
|
|
||||||
|
if err := r.ParseMultipartForm(8192); err != nil {
|
||||||
fmt.Fprintf(w, "ParseMultipartForm() err: %v", err)
|
fmt.Fprintf(w, "ParseMultipartForm() err: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Fprintf(w, "POST request successful")
|
fmt.Fprintf(w, "POST request successful")
|
||||||
//uncommentfile := r.FormValue("file")
|
|
||||||
//uncommenttext := r.FormValue("text")
|
//text := r.FormValue("text")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="no-js">
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
@ -11,15 +11,17 @@
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuidv4.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuidv4.min.js"></script>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<img src="/enemyfelled.png" /></marquee>
|
<center>
|
||||||
|
<img src="/enemyfelled.png" /></marquee>
|
||||||
|
|
||||||
<form id=upload enctype="multipart/form-data">
|
<form id=upload action="/submit" enctype="multipart/form-data">
|
||||||
<h2>a dumb lil elden ring generator i made (ALPHA)</h2>
|
<h2>a dumb lil elden ring generator i made (ALPHA)</h2>
|
||||||
<input type="file" name="file" required></br></br>
|
<input type="file" name="file" required></br></br>
|
||||||
<h3>Enter your text</h3>
|
<h3>Enter your text</h3>
|
||||||
<input type="text" name="text" id="text" required>
|
<input type="text" name="text" id="text" required>
|
||||||
</form>
|
<button type=submit class="btn btn-primary">Upload</button>
|
||||||
<center><button type=submit onclick=butts() class="btn btn-primary">Upload</button></center>
|
</form>
|
||||||
|
</center>
|
||||||
<center>
|
<center>
|
||||||
<h4>More options coming soon same with some styling to make it not look like another of my projects</h4>
|
<h4>More options coming soon same with some styling to make it not look like another of my projects</h4>
|
||||||
</center>
|
</center>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue