简体   繁体   中英

Error Google Drive Insert API: Operation timed out

I have an error when calling Google Drive API v2 ( https://developers.google.com/drive/v2/reference/files/insert ):

$service->files->insert()     

My script first upload file to server then upload file to Google Drive storage. It works fine form small file, but if I try large file (90-100 MB) i got:

An error occurred: Operation timed out after 100000 milliseconds with 0 bytes received.

Is it a Google limit (doc: Maximum file size: 5120GB) or I need to set any PHP parameters ?
I use same code included in previous link and I tried to increase this params in php.ini:

  • upload_max_filesize = 100M
  • post_max_size = 100M
  • max_execution_time = 300
  • max_input_time = 300
  • memory_limit = 1024M

The file is uploaded correctly on server.

I can't help you with php, as I'm not familiar with it. But a similar problem was encountered while I was working on a .NET project.

The solution was to set the Timeout parameter of the Drive service object, like mentioned here :

If you see this exception, consider manually increasing the Timeout property in the client used by your service object.

in C#, the code looked something like:

service.HttpClient.Timeout = TimeSpan.FromMinutes(100);

I remember having to reference System.Net.Http .

Hope this would give you some insight and would help you fix it in php.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM