Beispiel #1
0
func sampleHandler2(w http.ResponseWriter, r *http.Request) {
	// [START uploading_a_blob_3]
	ctx := appengine.NewContext(r)
	blobs, _, err := blobstore.ParseUpload(r)
	if err != nil {
		serveError(ctx, w, err)
		return
	}
	file := blobs["file"]
	if len(file) == 0 {
		log.Errorf(ctx, "no file uploaded")
		http.Redirect(w, r, "/", http.StatusFound)
		return
	}
	http.Redirect(w, r, "/serve/?blobKey="+string(file[0].BlobKey), http.StatusFound)
	// [END uploading_a_blob_3]

	// [START serving_a_blob]
	blobstore.Send(w, appengine.BlobKey(r.FormValue("blobKey")))
	// [END serving_a_blob]
}
Beispiel #2
0
func handleServe(w http.ResponseWriter, r *http.Request) {
	blobstore.Send(w, appengine.BlobKey(r.FormValue("blobKey")))
}
Beispiel #3
0
func Serve(c *gin.Context) {
	r := c.Request
	w := c.Writer
	blobstore.Send(w, appengine.BlobKey(r.FormValue("blobKey")))
}
Beispiel #4
0
func getImage(res http.ResponseWriter, req *http.Request, ps httprouter.Params) {
	// requesting an image based on blob key
	blobstore.Send(res, appengine.BlobKey(ps.ByName("blobKey")))
}
func idiomPicture(w http.ResponseWriter, r *http.Request) error {
	// From https://developers.google.com/appengine/docs/go/blobstore/#Complete_Sample_App
	blobstore.Send(w, appengine.BlobKey(r.FormValue("blobKey")))
	return nil
}
Beispiel #6
0
func serveFull(w http.ResponseWriter, r *http.Request, m map[string]interface{}) {
	blobstore.Send(w, appengine.BlobKey(r.FormValue("blobkey")))
}