Windows Phone 8 のバックグラウンド転送アップロード要求で投稿パラメーターを渡す方法は? パラメータをサーバーに渡す必要があります(パラメータ名「userfile」とパラメータのファイル名「song.m4a」を投稿)
1 に答える
0
// server to POST to
string url = "myserver.com/path/to/my/post";
// HTTP web request
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.ContentType = "text/plain; charset=utf-8";
httpWebRequest.Method = "POST";
// Write the request Asynchronously
using (var stream = await Task.Factory.FromAsync<Stream>(httpWebRequest.BeginGetRequestStream,
httpWebRequest.EndGetRequestStream, null))
{
//create some json string
string json = "{ \"my\" : \"json\" }";
// convert json to byte array
byte[] jsonAsBytes = Encoding.UTF8.GetBytes(json);
// Write the bytes to the stream
await stream.WriteAsync(jsonAsBytes, 0, jsonAsBytes.Length);
}
このコードを試して、この回答を読んでください Http Post for Windows Phone 8
于 2014-11-17T09:38:43.897 に答える