Thursday, 15 August 2013

google app engine - How to extend the datastore example with an image upload to blobstore -



google app engine - How to extend the datastore example with an image upload to blobstore -

i spent few days researching , think it's general plenty question inquire here benefit other beginners. have few ideas how solve , guidance of more experienced person.

the illustration code in https://developers.google.com/appengine/docs/go/gettingstarted/usingdatastore creates template , redirects "/sign" when submit button pressed. @ "/sign", form values loaded datastore , client redirected "/"

the illustration code in https://developers.google.com/appengine/docs/go/blobstore/ creates template , understanding when submit button pressed, form values loaded blobstore , client redirected "/upload"

so understanding, in blobstore, writing before redirecting "/upload", , in datastore, writing after redirecting "/sign"

so question how split writing image blobstore , writing info image datastore when pressing submit?

the simplest solution thought of on "submit" utilize blobstore method , write blobstore info r.fromvalue("info") , set datastore. disadvantage have duplicate of "info" in both datastore , blobstore.

the other solution "submit" form datastore method , manually set image blobstore. way found it, might not optimal, convert image []byte (golang converting image.image []byte) blobstore.create , writer.write([]byte) disadvantage of method image might big redirected "/sign". comment inexperienced intuition , might wrong.

i highly appreciate help

google-app-engine go gae-datastore blobstore

No comments:

Post a Comment