0
我試圖使用Web客戶端上傳視頻,但我不能夠在這裏做這樣 上傳視頻是我的代碼如何使用Web客戶端在Windows Phone 7的
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);
}
}
PLZ建議如何上傳
服務是一個多部分類型的服務,你上傳的數據 – CognitiveDesire 2012-07-11 05:55:06