Increase default max upload size to 5GB
This commit is contained in:
@@ -27,7 +27,12 @@ const idLength = 8
|
||||
const idCharset = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||
|
||||
// defaultMaxUploadSize is used when MAX_UPLOAD_SIZE is not set.
|
||||
const defaultMaxUploadSize int64 = 32 << 20 // 32MB
|
||||
const defaultMaxUploadSize int64 = 5 << 30 // 5GB
|
||||
|
||||
// maxMultipartMemory caps how much of a multipart upload is buffered in
|
||||
// memory before spilling to temporary files on disk, regardless of
|
||||
// maxUploadSize.
|
||||
const maxMultipartMemory int64 = 32 << 20 // 32MB
|
||||
|
||||
var indexHTML *template.Template
|
||||
var maxUploadSize int64 = defaultMaxUploadSize
|
||||
@@ -219,8 +224,8 @@ func handleMultipartUpload(w http.ResponseWriter, r *http.Request, start time.Ti
|
||||
r.Body = http.MaxBytesReader(w, r.Body, maxUploadSize)
|
||||
|
||||
memoryLimit := maxUploadSize
|
||||
if memoryLimit > defaultMaxUploadSize {
|
||||
memoryLimit = defaultMaxUploadSize
|
||||
if memoryLimit > maxMultipartMemory {
|
||||
memoryLimit = maxMultipartMemory
|
||||
}
|
||||
|
||||
if err := r.ParseMultipartForm(memoryLimit); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user