简体   繁体   中英

Upload image on Google Cloud Storage with Google Endpoints

I'm trying to create a RESTFul Web Service for upload photos. Is it possible create a Google Cloud Endpoints to upload images/photos? My problem is that I can't understand how to write the function declaration and which parameters I need to handle.

public void uploadPhoto(@Named("token") String token, @Named("title") String title, @Named("description") String description, @Named("photo") HttpServletRequest req) {}

If I handle value of req, what I will find in it? Thank you

The easiest way to do this is store your image as a base64 encoded string. Then you treat it exactly the same way you would any other string in your request.

Once you get it to appengine you can decode the base64 and upload it using the blobstore api as normal.

Note: as some commentators have said uploading directly to GCS may be a more elegant solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM