MCPcopy Create free account
hub / github.com/chanify/chanify / readFileFromForm

Function readFileFromForm

core/msgparam.go:331–341  ·  view source on GitHub ↗
(form *multipart.Form, name string)

Source from the content-addressed store, hash-verified

329}
330
331func readFileFromForm(form *multipart.Form, name string) ([]byte, string, error) {
332 fs := form.File[name]
333 if len(fs) > 0 {
334 if fp, err := fs[0].Open(); err == nil {
335 defer fp.Close()
336 data, err := io.ReadAll(fp)
337 return data, fs[0].Filename, err
338 }
339 }
340 return nil, "", ErrNoContent
341}
342
343func tryStringValue(value string, newValue string) string {
344 if len(value) <= 0 && len(newValue) > 0 {

Callers 1

ParseFormDataMethod · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected