MCPcopy
hub / github.com/pocketbase/pocketbase / NewFileFromMultipart

Function NewFileFromMultipart

tools/filesystem/file.go:81–90  ·  view source on GitHub ↗

NewFileFromMultipart creates a new File from the provided multipart header.

(mh *multipart.FileHeader)

Source from the content-addressed store, hash-verified

79
80// NewFileFromMultipart creates a new File from the provided multipart header.
81func NewFileFromMultipart(mh *multipart.FileHeader) (*File, error) {
82 f := &File{}
83
84 f.Reader = &MultipartReader{Header: mh}
85 f.Size = mh.Size
86 f.OriginalName = mh.Filename
87 f.Name = normalizeName(f.Reader, f.OriginalName)
88
89 return f, nil
90}
91
92// NewFileFromURL creates a new File from the provided url by
93// downloading the resource and load it as BytesReader.

Callers 3

TestNewFileFromMultipartFunction · 0.92
FindUploadedFilesMethod · 0.92
extractPrefixedFilesFunction · 0.92

Calls 1

normalizeNameFunction · 0.85

Tested by 1

TestNewFileFromMultipartFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…