OiO.lk Blog pdf Error: “Content type is not Multipart/Form-data” for large PDF/JPG uploads
pdf

Error: “Content type is not Multipart/Form-data” for large PDF/JPG uploads


I’m encountering an issue when trying to upload files larger than 10MB. when I attempt to upload a PDF or JPG file that exceeds this size, I receive the following error message:

Error: "Content type is not Multipart/Form-data"

However, smaller files (under 10MB) upload without any issues.
Here’s the code I’m using to handle the file upload:


    `r.Body = http.MaxBytesReader(w, r.Body, 32<<20+1024)
    //reader, err := r.ParseMultipartForm(maxFileSize)
    reader, err := r.MultipartReader()

    if err != nil {
        fmt.Println("server.go:FileUpload:Error during MultipartReader:", err)
        err = fmt.Errorf(err.Error())
        return nil, err
    }

    fmt.Println("server.go:FileUpload:NO Error during MultipartReader:")` 

What could be causing this problem, and how can I resolve it?



You need to sign in to view this answers

Exit mobile version