Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
giahh
11 months agoNew member | Level 1
Problem with HttpClient
var uri = new Uri("https://www.dropbox.com/scl/fi/l2ltdldscgwr9ho1izx57/TestUpdate-pass.zip?rlkey=cn5adnh45sc3793j60gunn3x8&st=u8atpaop&dl=1"); var httpClientHandler = new HttpClientHandler { ...
giahh
11 months agoNew member | Level 1
I used this code:
namespace Test_Dropbox
{
internal class Program
{
static void Main(string[] args)
{
var uri = new Uri("https://www.dropbox.com/scl/fi/4isq7l500diw6kjjd7hkq/ZipExtractor.zip?rlkey=fsoxq9o89zdqb8mr4ug8ml1uo&st=g7gpau7c&dl=1");
var httpClientHandler = new HttpClientHandler
{
AllowAutoRedirect = true,
};
var httpClient = new HttpClient(httpClientHandler);
httpClient.Timeout = TimeSpan.FromSeconds(60);
// Accept binary data
httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/octet-stream"));
HttpResponseMessage response = httpClient.GetAsync(uri).Result;
if (response.IsSuccessStatusCode)
{
byte[] zipFileData = response.Content.ReadAsByteArrayAsync().Result;
// Save the zip file to disk
File.WriteAllBytes("output.zip", zipFileData);
}
else
{
Console.WriteLine("{0}: {1} ({2})", uri, (int)response.StatusCode, response.ReasonPhrase);
}
Console.ReadKey();
Environment.Exit(0);
}
}
}it use HttpClient to Download a zip file without password from the link above and always got this error:
The zipped file seem corrupted. How could I fix the code to work properly with dropbox?
DB-Des
Dropbox Community Moderator
11 months agoHi giahh
It seems that the issue may lie within your integration since the file is downloading as expected from our servers, and the behavior Dropbox is functioning as designed. We recommend further troubleshooting on your end to identify any potential factors affecting the behavior.
If you have any specific questions about our API functionality, feel free to let us know, and we’ll be happy to assist where possible.
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!