I got it!!!!!! After reading 100000000 times the API code, I did using this code (just need to do a better one, but it works!):
$file = new Google_DriveFile();
$file->setTitle($file_name);
$file->setDescription($file_name);
$file->setMimeType('binary/octet-stream');
// Set the Parent Folder on Google Drive
$parent = new Google_ParentReference();
$parent->setId($parent_id);
$file->setParents(array($parent));
// Now here is the trick: Create a Google Media File Upload, you will use this to "activate" the upload
// The parameters are: mimeType, data, resumable (true), and the chunk size (I set in this case 2MB, de default are 256KB)
$media = new Google_MediaFileUpload('binary/octet-stream', file_get_contents($local_path . $f_nome), true, (2048*1024));
$media->progress = 0;
$media->mimeType = 'binary/octet-stream';
// Now, you call the insert and pass de mediaUpload parameter as your $media
$file_request = $this->google_drive->files->insert($file, array('mimeType' => 'binary/octet-stream', 'mediaUpload' => $media));
// Now you do the upload
// While the upload are not complete, the $media->nextChunk() will always return false.
// When the upload are completed, will return an array with informations about the file uploaded
// You can verify the progress (int) $media->progress , the size (int) $media->size and the chunk (int) -> $media->chunkSize
$upload_result = false;
while ($upload_result === false) {
$upload_result = $media->nextChunk($file_request);
}
And be happy!!! :D
Hope this can be useful for others!
Att.
Christiano Becker