Hello everyone! I’m having trouble uploading documents to Google Drive through a Google Workspace account. I’m working with the Zend framework and keep running into issues.
Here’s my current code setup:
function createGoogleConnection($param = '') {
$authService = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$username = '[email protected]';
$password = 'mypassword';
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $authService);
return $client;
}
function uploadFileToGoogleDrive($driveService, $content, $fileName, $tempPath) {
$targetFile = $fileName;
if ($tempPath) {
$targetFile = $tempPath;
}
$documentEntry = $driveService->uploadFile($targetFile, $fileName, null, Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI);
}
$googleClient = createGoogleConnection();
$driveService = new Zend_Gdata_Docs($googleClient);
$result = uploadFileToGoogleDrive($driveService, true, $uploadedFile->name, $uploadedFile->temp_path);
But I keep getting this frustrating error message:
Expected response code 200, got 400 Inconsistent repeating query parameter
What could be causing this issue? Any help would be really appreciated!
I hit this exact error about two years ago while building a document management system. That 400 “Inconsistent repeating query parameter” error happens when Zend_Gdata duplicates parameters in the API request URL. It’s a known bug with older Zend versions trying to work with Google’s updated APIs. The library messes up HTTP requests, especially when handling auth tokens and file metadata at the same time. I ended up switching to Google’s newer PHP client library since Zend_Gdata got deprecated and doesn’t play nice with current Google Drive API endpoints. The newer client handles parameters way better and doesn’t have these duplication issues.
yeah, i remember this pain… zend framework’s pretty outdated for google drive stuff now. check your temp_path variable for weird characters or spaces - that usually breaks query params. also make sure you’re not passing the same parameter twice in uploadFile.
This happens because you’re using ClientLogin with Zend_Gdata_Docs, but Google killed off ClientLogin years ago. The 400 error isn’t about your file upload code - it’s Google rejecting the old username/password auth method entirely. You’ll need to switch to OAuth2 instead. Even if you stick with Zend framework, you’ve got to implement proper OAuth2 flow using Google’s current auth standards. Basically, Google’s telling you the authentication method is dead, not that your upload logic is broken.