Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8283047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:35:45+00:00 2026-06-08T10:35:45+00:00

I am storing a file in Google App Engine using Google Cloud Storage. The

  • 0

I am storing a file in Google App Engine using Google Cloud Storage. The file is loaded fine but the serve returns a file interpreted as a binary not as the original mime type. You’ll find hereafter the code. Has anyone an idea of what is happening ?

I. Store file

GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder()
.setBucket(BUCKET_NAME)
.setKey(objectId)
.setAcl("project-private")
.setMimeType(mimeType)
.setContentDisposition("attachment;filename "+item.getName());

II. Serve file

blobKey = blobstoreService.createGsBlobKey(“/gs/”+BUCKET_NAME+”/”+ fileName);

blobstoreService.serve(blobKey, resp);

III. Difference with serving a file in the blobstore

I had a piece of code which used to work. The problem is that apparently the BlobInfo object is only for objects stored in the blobstore and not in the Google Cloud Storage

BlobInfo blobInfo = blobInfoFactory.loadBlobInfo(blobKey); 
resp.setContentLength(new Long(blobInfo.getSize()).intValue()); 
resp.setHeader("content-type", blobInfo.getContentType()); 
resp.setHeader("content-disposition", "attachment; filename=" + 
blobInfo.getFilename()); 
        blobstoreService.serve(blobKey, resp);  

Any help is very welcome !

Thanks,

Hugues

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:35:47+00:00Added an answer on June 8, 2026 at 10:35 am

    Because you’re serving the blob yourself, using the blob serving service, it’s up to you to set all the HTTP headers, including the content type, correctly. If you want to use the content type of the stored object, you should fetch it and set it in the headers yourself.

    Alternatively, you could link directly to the object’s path in Google Storage, in which case it will be served by the Google Storage infrastructure, with the correct mimetype.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know Google App Engine offers free space, but I wonder if it's for
I want to upload one image to the database by using Google app engine
I'm using google app engine to develop an upload form to upload a csv
I have a few questions about google app engine / datastore and storing dynamic
Using Google App Engine (python SDK), I created a custom JSONProperty() as a subclass
In a python/google app engine app, I've got a choice between storing some static
so I am trying to build a google app engine using servlets, filters etc.
I'm using google app engine/python. And I have created a custom datatype and property.
I'm developing an application on Google App Engine using the current django non-rel and
I am using flask on google app engine and am desperately looking for help

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.