Go version

go version go1.22.4 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY='none'
GONOSUMDB='xxx/*'
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE='xxx/*'
GOPROXY='https://proxy.golang.org'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/user/Documents/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2691332075=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I'm running into an issue with my Go server when trying to upload files around 10MB using a simple file upload form. In my browser, I'm seeing a "The connection was reset" error, and I'm not sure what is causing this problem or how to fix it.

Here’s my current setup: https://go.dev/play/p/7TVn-njfeiH

When I attempt to upload a file around 10MB through this form, the browser gives me a "The connection was reset" error. I’ve verified that smaller files upload without any issues.

What did you see happen?

Golang

When I attempt to upload a file around 10MB through this form, the browser gives me a "The connection was reset" error. I’ve verified that smaller files upload without any issues.

What did you expect to see?

My uploadHandler currently does nothing but send a 200 OK status. Ideally, I'd like to process the file upload without reading it entirely into memory, to handle larger file uploads efficiently.

Can anyone help me understand why I'm getting this error and how to properly handle large file uploads without reading them completely into memory?

Thanks in advance!

Comment From: gabyhelp

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: seankhliao

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions