0

I am trying to download the file through google picker the pdf and docx extension files are getting downloaded perfectly fine.

But the issue I am facing is that while selecting the doc extension file the object return file size as zero. In other words ‘PickerCallBack’ function of API provide the correct mime type but the file size is zero in response.

Have a look at screen shot in which we can see file size is zero.

Click here to view Response information screen shot

So if I continue this process by using the file ID & authentication token I am able to get the download ULR which is then passed to below PHP code.

$request = new Google_Http_Request($downloadUrl, 'GET', null, null);

Then using this request object if you try to get the file content it returns empty.

$httpRequest = $service->getClient()->getAuth()->authenticatedRequest($request);
$httpRequest->getResponseBody();

Reference: https://developers.google.com/drive/v2/web/manage-downloads#examples

Note: All this process is working fine for pdf and docx extension, only issue is with doc extension files.

So I need to know what I should do so that I would be able to get the file content in response of doc extension files.

Techleadz Team
  • 198
  • 2
  • 15

1 Answers1

0

As discussed in Entering file extensions in the manifest,

The recommended best practice for Drive is to register both MIME types and file extensions.

The important parts of the manifest to modify are the type and href field:

  • In the type field, enter the MIME types and file extensions you'd like your app to be searchable by.
  • In the href field, enter the same URL you provided in the manifest for web_url.

In addition to that, please do note that in Setting MIME types and file extensions:

Specify the MIME types and file extensions your app can open. When entering these values, consider the following:

  • Specify both MIME types and file extensions. There are cases where just one or the other is not sufficient.
  • Make sure the MIME types you enter are standard, canonical types or Google MIME types, free of typos or misspellings.
  • Consider carefully whether your app needs default or secondary status.

You may go through the given documentations for the following details too:

  • supported mime types
  • Default vs. Secondary status is related to opening files with your app by default
Community
  • 1
  • 1
Teyam
  • 7,686
  • 3
  • 15
  • 22
  • the link you have provided here is about "Chrome Web Store Listing" but I am downloading the file using download URL which is completely different than what you have provided here. I think you have missed the reference provided in my post. In documentation they are not even using the mime type just downloading the file using download URL The code I am using is working fine for docx, pdf, rtf & txt only issue is with doc extension. – Techleadz Team Jun 21 '16 at 19:30