Skip to content

Instantly share code, notes, and snippets.

@sofyan-ahmad
Created April 24, 2016 15:17
Show Gist options
  • Save sofyan-ahmad/f087e2b7f1a2f5839e6bbe0bb4abbc6e to your computer and use it in GitHub Desktop.
Save sofyan-ahmad/f087e2b7f1a2f5839e6bbe0bb4abbc6e to your computer and use it in GitHub Desktop.
r.ParseMultipartForm(32 << 20)
file, handler, err := r.FormFile("userphoto")
utils.HandleWarn(err)
defer file.Close()
fmt.Fprintf(w, "%v", handler.Header)
f, err := os.OpenFile("./uploads/user_avatars/"+handler.Filename, os.O_WRONLY|os.O_CREATE, 0666)
utils.HandleWarn(err)
defer f.Close()
io.Copy(f, file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment