locked
How to upload the large size(upto 2mb) image as base64 string in server?

    Question

  • Hi i have too much trouble while upload the large size image in server...while i try to upload the image as base64 string it replies Invalid URI : The url string is too long...
    Monday, February 24, 2014 5:12 AM

All replies

  • How are you trying to upload it? Are you trying to include the encoded string in the url?

    See Quickstart: Uploading a file for an example of using the BackgroundUploader to upload a large file.

    --Rob

    Monday, February 24, 2014 5:38 AM
    Owner
  • by this way i try to upload the image in server...

    if (imageBytes != null)
                        {
                            strPostdata = System.Convert.ToBase64String(imageBytes);
                        }
                        else
                        {
                            MessageDialog msg = new MessageDialog("Please Browse Picture.");
                            msg.ShowAsync();
                            txtImg.Text = "Enter....";
                            popupAddPicture.IsOpen = true;
                        }
                        var parameters = new List<KeyValuePair<string, string>>
                            {
                                new KeyValuePair<string,string>("stype", "wall_post"),
                                new KeyValuePair<string,string>("postby_id", App.pblLogDetail.member_id),
                                new KeyValuePair<string,string>("pt_content", txtImg.Text),
                                new KeyValuePair<string,string>("up_img",strPostdata),
                                new KeyValuePair<string ,string>("img_name",strImagename)
                            };

    HttpClient httpClient = new HttpClient();
                        httpClient.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; TFMobile; Trident/6.0)");
                        HttpContent content = new FormUrlEncodedContent(parameters);
                        var response = await httpClient.PostAsync(App.url, content);
                        var responseString = await response.Content.ReadAsStringAsync();

    Monday, February 24, 2014 5:54 AM