code: func (b *Bslack) uploadFile(msg *config.Message, channelID string) {
  	for _, f := range msg.Extra["file"] {
  		fi, ok := f.(config.FileInfo)
  		if !ok {
  			b.Log.Errorf("Received a file with unexpected content: %#v", f)
  			continue
  		}
  		if msg.Text == fi.Comment {
  			msg.Text = ""
  		}
  		// Because the result of the UploadFile is slower than the MessageEvent from slack
  		// we can't match on the file ID yet, so we have to match on the filename too.
  		ts := time.Now()
  		b.Log.Debugf("Adding file %s to cache at %s with timestamp", fi.Name, ts.String())
  		b.cache.Add("filename"+fi.Name, ts)
  		initialComment := fmt.Sprintf("File from %s", msg.Username)
  		if fi.Comment != "" {
  			initialComment += fmt.Sprintf("with comment: %s", fi.Comment)
  		}
  		res, err := b.sc.UploadFile(slack.FileUploadParameters{
  			Reader:          bytes.NewReader(*fi.Data),
  			Filename:        fi.Name,
  			Channels:        []string{channelID},
  			InitialComment:  initialComment,
  			ThreadTimestamp: msg.ParentID,
  		})
  		if err != nil {
  			b.Log.Errorf("uploadfile %#v", err)
  			return
  		}
  		if res.ID != "" {
  			b.Log.Debugf("Adding file ID %s to cache with timestamp %s", res.ID, ts.String())
  			b.cache.Add("file"+res.ID, ts)
  		}
  	}
  }
docs: // uploadFile handles native upload of files