Windows phone 7 Wp7映像未上载到服务器?

Windows phone 7 Wp7映像未上载到服务器?,windows-phone-7,windows-phone-7.1,Windows Phone 7,Windows Phone 7.1,这是我想发布的请求示例,这是我需要在服务器上发布以上载图像的方式: Request POST /updateprofile HTTP/1.1 Host: <ip:port> Content-Type: multipart/mixed, boundary=”myboundary” User-Agent: <Device User Agent> --myboundary Content-Length: 2234 Delegateid=<did>&prof

这是我想发布的请求示例,这是我需要在服务器上发布以上载图像的方式:

Request
POST /updateprofile HTTP/1.1
Host: <ip:port>
Content-Type: multipart/mixed, boundary=”myboundary”
User-Agent: <Device User Agent>

--myboundary
Content-Length: 2234
Delegateid=<did>&profileid=0&title=<title>& userid=<uid>&seequestion=<seequestion>&seeanswer=<seeanswer>&fname=<fname>&lname=<lname>&ccountry=<citycountry>&company=<company>&ptitle=<ptitle>&industry=<industry>&looking=<looking>&address=<address>&mobile=<mobile>&phone=<phone>&weburl=<weburl>&keys=k1|k2&values=v1111|v2222&encoding=base64&sendpic=1

--myboundary
Content-Type:image/jpeg
Content-Length: 1234

XXX Binary jpeg image xxx

--myboundary--

你试过什么?看起来您没有对图像进行Base64编码,但您正在将编码设置为Base64。我也试过了,但还是没有用
void _cameraCapture_Completed(object sender, PhotoResult e)
{
capturedImage = e.ChosenPhoto;
BitmapImage bmp = new BitmapImage();
bmp.SetSource(capturedImage);
MemoryStream ms = new MemoryStream();
WriteableBitmap wb = new WriteableBitmap(bmp);
wb.SaveJpeg(ms, 40, 40, 0, 40);
imageBytes = ms.ToArray();
SendPost();
}

   void SendPost()
        {

            if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                MessageBox.Show("No network connection available!");
                return;
            }

            //http://stackoverflow.com/questions/5952094/wp7-windows-phone-7-httpwebrequest-losing-post-data

            System.Uri uri = new Uri("http://www.www.com/updateprofile.do);
            // Create the web request object
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);

            webRequest.Method = "POST";
            webRequest.ContentType = "application/x-www-form-urlencoded";
           
         webRequest.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), webRequest);
        }
  private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
        {
   
            //postData += ("&profileid=" + "0");
            //postData += ("&title=" + "Mr");
            //postData += ("&userid=" + "iphone@cubixlabs.com");
            //postData += ("&seequestion=" + "squestion");
            //postData += ("&seeanswer=" + "sanswer");

            //postData += ("&fname=" + "asim");
            //postData += ("&lname=" + "siddiqui");
            //postData += ("&ccountry=" + "London, United Kingdom");
            //postData += ("&company=" + "Google");
            //postData += ("&ptitle=" + "asim");
            //postData += ("&industry=" + "Transportation & Package/Freight Delivery");
            //postData += ("&looking=" + "Career Opportunities");
            //postData += ("&oldpasswd=" + "f30aa7a662c728b7407c54ae6bfd27d1");

            //postData += ("&newpasswd=" + "f30aa7a662c728b7407c54ae6bfd27d1");
           
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);

            // Add the post data to the web request
            postStream.Write(byteArray, 0, byteArray.Length);
            postStream.Close();

            // Start the web request
            webRequest.BeginGetResponse(new AsyncCallback(GetResponseCallback), webRequest);
   }

        void GetResponseCallback(IAsyncResult asynchronousResult)
        {

            HttpWebRequest webRequest = (HttpWebRequest)asynchronousResult.AsyncState;
            HttpWebResponse response;

            // End the get response operation
            response = (HttpWebResponse)webRequest.EndGetResponse(asynchronousResult);
            Stream streamResponse = response.GetResponseStream();
            StreamReader streamReader = new StreamReader(streamResponse);
            var Response = streamReader.ReadToEnd();
            //MessageBox.Show(Response.ToString());
           

        }