title: How to convert type multipart.File to *os.File in Golang
body: <p>I am trying to upload video to CloudFlare, but in docs they use os.Open but in my situation user uploads file via html form</p>
  
  <p>Golang CloudFlare Docs: <a href="https://developers.cloudflare.com/stream/getting-started/uploading-golang/" rel="nofollow noreferrer">https://developers.cloudflare.com/stream/getting-started/uploading-golang/</a></p>
  
  <pre><code>file, err := c.FormFile("file")
  if err != nil {
      log.Errorf("get file error: %s", err)
      return c.JSONStatus(http.StatusBadRequest)
  }
  
  sourceFile, err := file.Open()
  if err != nil {
      log.Errorf("open file error: %s", err)
      return c.JSONStatus(http.StatusInternalServerError)
  }
  
  headers := make(http.Header)
  headers.Add("X-Auth-Email", "***")
  headers.Add("X-Auth-Key", "***")
  
  config := &amp;tus.Config{
      ChunkSize:           5 * 1024 * 1024, // Cloudflare Stream requires a minimum chunk size of 5MB.
      Resume:              false,
      OverridePatchMethod: false,
      Store:               nil,
      Header:              headers,
  }
  
  client, _ := tus.NewClient("https://api.cloudflare.com/client/v4/accounts/"+ accountID +"/media", config)
  
  upload, _ := tus.NewUploadFromFile(sourceFile)
  
  uploader, _ := client.CreateUpload(upload)
  
  uploader.Upload()
  </code></pre>