文件上传不能在Win phone 8 3G连接上使用 [英] File uploading not working on Win phone 8 3G connection
本文介绍了文件上传不能在Win phone 8 3G连接上使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个应用程序,用户可以在其中记录视频和api将录制的视频上传到天蓝。我使用下面的代码
HttpClientHandler handler = new HttpClientHandler();
handler.MaxRequestContentBufferSize = int.MaxValue;
using(HttpClient httpClient = new HttpClient(handler)
{
MaxResponseContentBufferSize = int.MaxValue
})
{
MultipartFormDataContent content = new MultipartFormDataContent() ;
content.Add(new ByteArrayContent(chunks),file,fileName);
HttpResponseMessage response = null;
response = await httpClient.PostAsync(new Uri(url),content);
返回等待response.Content.ReadAsStringAsync();
$ b $ p
$ b 这只有当连接是wifi或3G视频小于10秒当我试图上传大小约20-30 MB的视频比失败。作为回应,我得到了状态代码404 Not Found。
我也尝试了另一种上传方式,但遇到同样的错误。
I have a app in which user can record video and an api to upload recorded video to azure. I am using below code
HttpClientHandler handler = new HttpClientHandler();
handler.MaxRequestContentBufferSize = int.MaxValue;
using (HttpClient httpClient = new HttpClient(handler)
{
MaxResponseContentBufferSize = int.MaxValue
})
{
MultipartFormDataContent content = new MultipartFormDataContent();
content.Add(new ByteArrayContent(chunks), "file", fileName);
HttpResponseMessage response = null;
response = await httpClient.PostAsync(new Uri(url), content);
return await response.Content.ReadAsStringAsync();
}
This is working only when either connection is wifi or on 3G video is less than of 10 sec. When I tried to upload video of size around 20-30 MB than it fails. In response I got status code 404 Not Found.
I also tried another way to upload but caught same error.
解决方案 At last, I have changed my api code and send request with 1 mb chunks.
这篇关于文件上传不能在Win phone 8 3G连接上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文