File uploads in Go

Parse multipart form requests in Go using ParseMultipartForm and FormFile to handle file uploads.

Use http.Request.ParseMultipartForm to parse the request body and access uploaded files via r.FormFile.

r.ParseMultipartForm(32 << 20) // 32 MB max
file, header, err := r.FormFile("file")
if err != nil {
    http.Error(w, err.Error(), http.StatusBadRequest)
    return
}
// Save file: io.Copy(os.Create("path"), file)