Upload fails on files larger than ChunkSize (UWP)
See original GitHub issueI use google Api with UWP project Nugets(Google.Apis 1.31.0-beta01, Google.Apis.Auth 1.31.0-beta01, Google.Apis.Drive.v3 1.30.0.1044) were installed.
I try upload file on google drive.
public async UploadAsync(string parentId, string fileName, IStorageFile inputFile, CancellationToken ct)
{
var body = new Google.Apis.Drive.v3.Data.File() {
Name = fileName,
Parents = new List<string>() { parentId }
};
using (var streamFile = await inputFile.OpenReadAsync()) {
using (var stream = streamFile.AsStreamForRead()) {
stream.Position = 0;
var uploadRequest = _driveService.Files.Create(body, stream, inputFile.ContentType);
uploadRequest.Fields = "id, name";
uploadRequest.ProgressChanged += (obj) =>
{
Debug.WriteLine($"sent - {obj.BytesSent}");
};
await uploadRequest.UploadAsync(ct);
var file = uploadRequest.ResponseBody;
Debug.WriteLine($"file - {file.Id}, {file.Name}");
}
}
}
I can only upload files < 10MB (by default). For large files(>10MB) UploadAsync doesn’t finish and obj.BytesSent always 0.
When I change uploadRequest.ChunkSize the upload limit also changes.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
C# - upload file by chunks - bad last chunk size
2. The short answer is that you should upload n bytes, not chunkSize bytes. · Unclear where chunkSize comes out from, but it...
Read more >Cannot transfer large files with BufferSize set to 4 MB
This happens because of two reasons: 1. There is some extra information (headers) that are passed to the server that inflate the junk...
Read more >PRB: Cannot Upload Large Files When You Use ...
This problem occurs because the default value for the maxRequestLength parameter in the <httpRuntime> section of the Machine.config file is 4096 (4 megabytes)....
Read more >C# UWP/WinRT FTP Large File Upload
The LargeFileUpload method is the same as PutFile, but designed to work around the following potential problem associated with an upload that is...
Read more >Uploads/Downloads Cannot Exceed Large File Chunk Size
We have a limited workaround. We have media files that exceed 200 MB, but I'm concerned about performance implications of increasing the chunk ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing as UWP is an unsupported platform. Will re-open and investigate if we add support for UWP.
Okay, so this is only a problem on UWP. At the moment, UWP is an unsupported platform, but we are working on UWP support - so we’ll need to make sure this works at that point too.
10MB is the size at which the upload uses multiple chunks, so presumably the problem is somewhere there.