Question

Hi guys I'm trying the code samples from zend frameworks site on how to upload a document to google docs but I keep getting this error.

PHP Fatal error:  Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 415
Content-Type application/x-www-form-urlencoded is not a valid input type.' in C:\...\Zend\Gdata\App.php:700

It can't be an unlisted type as I tried to upload even a .txt file - whats happening here - I've googled everywhere for an answer and landed nowhere - please help :(

Was it helpful?

Solution

The problem is the HTTP status code - 415 Unsupported Media Type. It seems that the code is out of date (are you on 1.10?). Here's the list of data you can upload from Google. Suggested fix is to check this list exists in Zend/library/Zend/Gdata/Docs.php:

private static $SUPPORTED_FILETYPES = array( 
      'CSV'=>'text/csv', 
      'DOC'=>'application/msword', 
      'ODS'=>'application/vnd.oasis.opendocument.spreadsheet', 
      'ODT'=>'application/vnd.oasis.opendocument.text', 
      'RTF'=>'application/rtf', 
      'SXW'=>'application/vnd.sun.xml.writer', 
      'TXT'=>'text/plain', 
      'XLS'=>'application/vnd.ms-excel');

Google groups posting here.

OTHER TIPS

The probem is the mimetype ("extension type that can't be identified ) Just Go to your library folder look Zend/Gdata/Docs.php file on line 244

insert this :

// Set the mime type of the data. if ($mimeType === null) { $filenameParts = explode('.', $slugHeader); // <-- now slugheader equals myfilename.txt $fileExtension = end($filenameParts); $mimeType = self::lookupMimeType($fileExtension); }

instead of this :

// Set the mime type of the data. if ($mimeType === null) { $filenameParts = explode('.', $fileLocation); $fileExtension = end($filenameParts); $mimeType = self::lookupMimeType($fileExtension); } and now everything is gonna be ok. ;) Enjoy it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top