title: File upload failing in golang
body: <p>In my use case I am trying to upload a file to server in golang. I have the following html code,</p>
  
  <pre><code>&lt;div class="form-input upload-file" enctype="multipart/form-data" &gt;
      &lt;input type="file"name="file" id="file" /&gt;
      &lt;input type="hidden"name="token" value="{{.}}" /&gt;
      &lt;a href="/uploadfile/" data-toggle="tooltip" title="upload"&gt;
          &lt;input type="button upload-video" class="btn btn-primary btn-filled btn-xs" value="upload" /&gt;
      &lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And the server side,</p>
  
  <pre><code>func uploadHandler(w http.ResponseWriter, r *http.Request) {
      // the FormFile function takes in the POST input id file
      file, header, err := r.FormFile("file")
      if err != nil {
          fmt.Fprintln(w, err)
          return
      }
      defer file.Close()
  
      out, err := os.Create("/tmp/uploadedfile")
      if err != nil {
          fmt.Fprintf(w, "Unable to create the file for writing. Check your write access privilege")
          return
      }
      defer out.Close()
  
      // write the content from POST to the file
      _, err = io.Copy(out, file)
      if err != nil {
          fmt.Fprintln(w, err)
      }
  
      fmt.Fprintf(w, "File uploaded successfully : ")
      fmt.Fprintf(w, header.Filename)
  }
  </code></pre>
  
  <p>When I try to upload the file, I am getting <code>request Content-Type isn't multipart/form-data</code> error in server side.</p>
  
  <p>Could anyone help me on this?</p>