Versuch, den Teilnehmer als Argument an Upload zu übergeben
This commit is contained in:
		@@ -2,12 +2,12 @@ package server
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/google/uuid"
 | 
			
		||||
	"html/template"
 | 
			
		||||
	"io"
 | 
			
		||||
	"log"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"streifling.com/jason/sicherheitsunterweisung/packages/db"
 | 
			
		||||
	"streifling.com/jason/sicherheitsunterweisung/packages/types"
 | 
			
		||||
)
 | 
			
		||||
@@ -80,18 +80,18 @@ func SubmitForm(db *db.DB, i, j *int64) http.HandlerFunc {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Upload(db *db.DB) http.HandlerFunc {
 | 
			
		||||
func Upload(fn, ln, d, t string) http.HandlerFunc {
 | 
			
		||||
	return func(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		r.ParseMultipartForm(10 << 20) // 10 MiB
 | 
			
		||||
 | 
			
		||||
		tmpFile, handler, err := r.FormFile("questionaire")
 | 
			
		||||
		tmpFile, _, err := r.FormFile("questionaire")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			http.Error(w, err.Error(), http.StatusInternalServerError)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		defer tmpFile.Close()
 | 
			
		||||
 | 
			
		||||
		file, err := os.Create(handler.Filename)
 | 
			
		||||
		file, err := os.Create(ln + fn + d + t + uuid.New().String() + ".png")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			http.Error(w, err.Error(), http.StatusInternalServerError)
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user