code: func (c *Client) Upload(ctx context.Context, f io.Reader, u *url.URL, param *Upload) error {
  	var err error
  
  	if param.Progress != nil {
  		pr := progress.NewReader(ctx, param.Progress, f, param.ContentLength)
  		f = pr
  
  		// Mark progress reader as done when returning from this function.
  		defer func() {
  			pr.Done(err)
  		}()
  	}
  
  	req, err := http.NewRequest(param.Method, u.String(), f)
  	if err != nil {
  		return err
  	}
  
  	req = req.WithContext(ctx)
  
  	req.ContentLength = param.ContentLength
  	req.Header.Set("Content-Type", param.Type)
  
  	for k, v := range param.Headers {
  		req.Header.Add(k, v)
  	}
  
  	if param.Ticket != nil {
  		req.AddCookie(param.Ticket)
  	}
  
  	res, err := c.Client.Do(req)
  	if err != nil {
  		return err
  	}
  
  	defer res.Body.Close()
  
  	switch res.StatusCode {
  	case http.StatusOK:
  	case http.StatusCreated:
  	default:
  		err = errors.New(res.Status)
  	}
  
  	return err
  }
docs: // Upload PUTs the local file to the given URL