echo icon indicating copy to clipboard operation
echo copied to clipboard

Bind file from multipart/form-data request

Open MilkeeyCat opened this issue 1 year ago • 2 comments

Issue Description

Checklist

  • [x] Dependencies installed
  • [x] No typos
  • [x] Searched existing issues and docs

Hi :D. Is there a way to bind file from multipart/form-data request to a struct field? For example

type Data struct {
	File multipart.FileHeader `form:"file"`
}

MilkeeyCat avatar Aug 09 '24 07:08 MilkeeyCat

no at the moment. Could you provide small example for posting data in that way (for example with curl) and I can think if there are some ways to do this.

Currently we delegate all form binding/parsing logic to standard library when it comes to form data. See https://github.com/labstack/echo/blob/f13e2640f0eacdbe1bffc076c25126368d6445d2/bind.go#L93

aldas avatar Aug 09 '24 07:08 aldas

curl -v http://localhost:8080 -F '[email protected]'

there should also be a file called image.png in the directory you execute the command or you can change the file path

MilkeeyCat avatar Aug 09 '24 08:08 MilkeeyCat

implemented by @martinyonatann in #2684

aldas avatar Oct 20 '24 18:10 aldas