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 8372857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:32:26+00:00 2026-06-09T14:32:26+00:00

I created a form and a simple server with google appengine with which to

  • 0

I created a form and a simple server with google appengine with which to upload arbitrary file types to my google drive. The form fails to work for certain file types and just gives this error instead:

HttpError: <HttpError 400 when requesting https://www.googleapis.com/upload/drive/v1/files?alt=json returned "Unsupported content with type: application/pdf">

Aren’t pdf files supported?

The appengine code that does the upload goes somewhat like this:

def upload_to_drive(self, filestruct):
    resource = {
        'title': filestruct.filename,
        'mimeType': filestruct.type,
    }
    resource = self.service.files().insert(
    body=resource,
    media_body=MediaInMemoryUpload(filestruct.value,
                                     filestruct.type),
    ).execute()


def post(self):
      creds = StorageByKeyName(Credentials, my_user_id, 'credentials').get()
      self.service = CreateService('drive', 'v1', creds)
      post_dict = self.request.POST
      for key in post_dict.keys():
          if isinstance(post_dict[key], FieldStorage):#might need to import from cgi
             #upload to drive and return link
             self.upload_to_drive(post_dict[key]) #TODO: there should be error handling here

I’ve successfully used it for MS Office documents and images. It doesn’t work for textfiles too and gives this error:

HttpError: <HttpError 400 when requesting https://www.googleapis.com/upload/drive/v1/files?alt=json returned "Multipart content has too many non-media parts">

I’ve tried unsetting the ‘mimeType’ value in the resource dict to let google drive set it automatically. I also tried unsetting the mime type value in the MediaInMemoryUpload constructor. Sadly, none of both worked.

  • 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-09T14:32:28+00:00Added an answer on June 9, 2026 at 2:32 pm

    It seems to me that you are using an old version of the Python client library and referring to Drive API v1, while Drive API v2 has been available since the end of June.

    Please try updating your library and check the complete Python sample at https://developers.google.com/drive/examples/python.

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

Sidebar

Related Questions

I have created a simple web app/form using google app engine. the site is
Some thing weird is happening. I created a simple form and Added an <asp:file
I have created a simple file upload page. To keep it really simple, I
I created a contact us form which should be simple and most importantly secure,
I am a bit confused. I have created a simple form with a one
I have created a simple test form with FormBorderStyle = FixedToolWindow by default and
I created a simple detail edit form earlier, and decided to data bind some
I'm trying to create a simple form with two different submit buttons: one which
I am trying to create a simple GUI form which has only 2 elements
Have a simple contact us XPage created. Have server side validation in place that

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.