AddFileSource adds a form file to the uploader with the given key.
(key, filename string, source io.Reader)
| 349 | |
| 350 | // AddFileSource adds a form file to the uploader with the given key. |
| 351 | func (u *Uploader) AddFileSource(key, filename string, source io.Reader) error { |
| 352 | f, err := u.Writer.CreateFormFile(key, filename) |
| 353 | if err != nil { |
| 354 | return err |
| 355 | } |
| 356 | |
| 357 | _, err = io.Copy(f, source) |
| 358 | return err |
| 359 | } |
| 360 | |
| 361 | // AddFile adds a local form file to the uploader with the given key. |
| 362 | func (u *Uploader) AddFile(key, filename string) error { |