I spent a few days researching this and I think it's a general enough question to ask here so that it would benefit other beginners. I have few ideas how to solve it and would like guidance of a more experienced person.
the example code in https://developers.google.com/appengine/docs/go/gettingstarted/usingdatastore creates a template and redirects to "/sign" when the submit button is pressed. At "/sign", the form values are loaded into datastore and the client is redirected to "/"
the example code in https://developers.google.com/appengine/docs/go/blobstore/ creates a template and from my understanding when the submit button is pressed, the form values are loaded into blobstore and the client is redirected to "/upload"
so from my understanding, in blobstore, the writing is before redirecting to "/upload", and in datastore, the writing is after redirecting to "/sign"
So the question is how do I split writing an image to blobstore and writing info about the image to datastore when pressing submit?
The simplest solution that I thought of is on "submit" to use blobstore method and write everything to blobstore then get data with r.FromValue("info") and put it into datastore. the disadvantage is that I have a duplicate of "info" in both datastore and blobstore.
The other solution would be to "submit" the form with datastore method and then manually put the image to blobstore. The way I found to do it, which might not be optimal, is to convert the image to []byte (Golang Converting image.Image to []byte) the us blobstore.Create and writer.write([]byte) The disadvantage of this method is that image might be too big to be redirected to "/sign". This comment is my inexperienced intuition and i might be wrong.
I highly appreciate your help