开发者

Fatal Error in uploading to google DOcs using Zend_GData

Hi guys I'm trying the code samples from zend framewor开发者_如何学JAVAks 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 :(


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜