Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I a new to windows development. I tried a lot to upload an image to the server, but I am unable to do so.

If anyone can help me out, please see my code below

void uploadphoto()
{
    WebClient webClient1 = new WebClient();
        webClient1.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient1_DownloadStringCompleted);
    webClient1.DownloadStringAsync(new Uri("Web Service"));
}

void webClient1_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
        var rootobject1 = JsonConvert.DeserializeObject<RootObject1>(e.Result);
    int error = rootobject1.response.errorFlag;
        string message = rootobject1.response.msg;
    if (error == 0)
            {
                    MessageBox.Show(message);
            }
        else
            {
                    MessageBox.Show(message);
            }
}

public class Response1
{
        public int errorFlag { get; set; }
        public string msg { get; set; }
        public List<string> uploadedImageNames { get; set; }
}

public class RootObject1
{
        public Response1 response { get; set; }
}


And I am using the code below for selecting the image:

private void ImageUpload(object sender, RoutedEventArgs e)
    {
        //MessageBoxResult mb = MessageBox.Show("Select the mode of uploading the picture", "", MessageBoxButton.OKCancel);
        Popup popup = new Popup();
        photoSelection photo = new photoSelection();
        popup.Child = photo;
        popup.IsOpen = true;
        photo.camera.Click += (s, args) =>
            {
                photoCameraCapture.Show();
                popup.IsOpen = false;
            };
        photo.library.Click += (s, args) =>
            {
                photoChooserTask.Show();
                popup.IsOpen = false;
            };
}


I am using those code for developing app for Windows Phone 8. I am using Json.Net.Please help me out. Thanx in advance.
Posted

1 solution

 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900