#send excel from json body to golang backend

5 messages · Page 1 of 1 (latest)

rigid fiber
#

is it possible to send an excel file on json body from client to a golang backend?

if so, what's the data type when it arrives on the backend? and how do i convert it io.Reader? i plan to parse the excel file using excelize

calm bone
#

If it's a multipart/form data request then you just use the parse form and form file methods to get it from the body

rigid fiber
#

"you just use the parse form and form file methods to get it from the body"

what would be the resulting data type after parsing from the body?

boreal parrotBOT
#
func (r *Request) FormFile(key string) (multipart.File, *multipart.FileHeader, error)

FormFile returns the first file for the provided form key. FormFile calls ParseMultipartForm and ParseForm if necessary.

#

type File interface {
    io.Reader
    io.ReaderAt
    io.Seeker
    io.Closer
}

File is an interface to access the file part of a multipart message. Its contents may be either stored in memory or on disk. If stored on disk, the File's underlying concrete type will be an *os.File.