мой код работает только для файла размером менее 5 МБ, но когда я пытаюсь использовать файл размером более 5 МБ, возникает исключение.
Private Sub UploadFile()
If service.ApplicationName <> "Google Drive" Then CreateService()
Dim thefile As New File With {
.Name = fileName,
.Description = "A Backup File",
.MimeType = "application/octet-stream"
}
Dim uploadrequest As FilesResource.CreateMediaUpload
Dim bytearry As Byte() = System.IO.File.ReadAllBytes(filePath)
Try
Using stream = New System.IO.MemoryStream(bytearry, System.IO.FileMode.Open)
uploadrequest = service.Files.Create(thefile, stream, "application/octet-stream")
uploadrequest.Fields = "id"
'MsgBox(uploadrequest.GetProgress.Status.ToString())
uploadrequest.Upload()
End Using
Dim file As File = uploadrequest.ResponseBody
My.Settings.lastFileUploaded = fileName
Catch ex As Exception
MsgBox("error Upload Failed:" + ex.StackTrace)
End Try
MsgBox("upload Finished`enter code here` " + file.Id)enter code here
End Sub
Изображение исключения