danielgtaylor / huma

Huma REST/HTTP API Framework for Golang with OpenAPI 3.1
https://huma.rocks/
MIT License
1.71k stars 134 forks source link

Accessing file name and file size in `multipart/form-data` request #465

Closed amsal closed 1 month ago

amsal commented 1 month ago

I was just trying out Feature: handling files from multipart/form-data request . It seems it doesn't currently export file name and size from the multipart header, or it could be changed to access the multipart file header directly.

// formdata.go
type FormFile struct {
    multipart.File
    ContentType string // Content-Type as declared in the multipart form field, or detected when parsing request as fallback
    IsSet       bool   // Indicates whether content was received when working with optional files

        Filename string
        Size int64
        // FileHeader *multipart.FileHeader // access file header directly?
}
danielgtaylor commented 1 month ago

@lsdch FYI