title: Read multipart-form data as []byte in GO
body: <p>I'm using <a href="https://github.com/gin-gonic/gin" rel="nofollow noreferrer">GIN</a> as GO framework, I'm having an issue when uploading file and directly convert image as byte so I can store it in my BLOB field inside db table, so I have my piece of code like this:</p>
  <pre><code>func (a *AppHandler) Upload(ctx *gin.Context) {
  
  form := &amp;struct {
      Name    string `form:&quot;name&quot; validate:&quot;required&quot;`
      Token   string `form:&quot;token&quot; validate:&quot;required&quot;`
      AppCode string `form:&quot;app_code&quot; validate:&quot;required&quot;`
  }{}
  ctx.Bind(form)
  if validationErrors := a.ValidationService.ValidateForm(form); validationErrors != nil {
      httpValidationErrorResponse(ctx, validationErrors)
      return
  }
  
  file, header, err := ctx.Request.FormFile(&quot;file&quot;)
  </code></pre>
  <p>and I'm trying to store it in db like this</p>
  <pre><code>app.SetFile(file)
  a.AppStore.Save(app)
  </code></pre>
  <p>and it returns this kind of error:</p>
  <blockquote>
  <p>cannot use file (type multipart.File) as type []byte</p>
  </blockquote>