Windows phone 7 如何在WindowsPhone7中使用webclient上载视频
我正在尝试使用webclient上载视频,但我无法这样做 这是我的密码Windows phone 7 如何在WindowsPhone7中使用webclient上载视频,windows-phone-7,Windows Phone 7,我正在尝试使用webclient上载视频,但我无法这样做 这是我的密码 private void UploadFile(string fileName) { Stream data = Application.GetResourceStream(new Uri(@"DemoProject;component/test.mp4", UriKind.Relative)).Stream; UriBuilder ub = new UriBuilder("http://www.abc.c
private void UploadFile(string fileName)
{
Stream data = Application.GetResourceStream(new Uri(@"DemoProject;component/test.mp4", UriKind.Relative)).Stream;
UriBuilder ub = new UriBuilder("http://www.abc.com/xyz/");
ub.Query = string.Format("name={0}", fileName);
WebClient c = new WebClient();
c.OpenWriteCompleted += (sender, e) =>
{
PushData(data, e.Result);
e.Result.Close();
data.Close();
};
c.OpenWriteAsync(ub.Uri);
}
private void PushData(Stream input, Stream output)
{
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = input.Read(buffer, 0, buffer.Length)) != 0)
{
output.Write(buffer, 0, bytesRead);
}
}
请建议如何上传我找到了答案,我使用了上面的代码刚刚传递了错误的url。该服务是一个多部分类型的服务,您在其中上传数据吗