Skip to content

Instantly share code, notes, and snippets.

@IndianGuru
Created October 2, 2015 07:16
Show Gist options
  • Select an option

  • Save IndianGuru/3ec9b66c5fb83d9dcc63 to your computer and use it in GitHub Desktop.

Select an option

Save IndianGuru/3ec9b66c5fb83d9dcc63 to your computer and use it in GitHub Desktop.
blobstrex3.go
func handleUpload(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
blobs, _, err := blobstore.ParseUpload(r)
if err != nil {
serveError(c, w, err)
return
}
file := blobs["file"]
if len(file) == 0 {
c.Errorf("no file uploaded")
http.Redirect(w, r, "/", http.StatusFound)
return
}
http.Redirect(w, r, "/serve/?blobKey="+string(file[0].BlobKey),
http.StatusFound)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment