Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6002123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:55:56+00:00 2026-05-23T00:55:56+00:00

I want to upload the image using the .NET webservices and that will be

  • 0

I want to upload the image using the .NET webservices and that will be called from iphone image.

the format of text that iphone is sending to me is like this.

http://d8768157.u118.c6.ixwebhosting.com/iphoneimg/image.txt

In which datatype i must convert this data and then save that in image format.

If you have any other method then please tell me.

I have tried converting this data in the byte[] but it is giving me error. here is my code. For what i have tried. please help me out.

[WebMethod]
    public XmlDocument testuploadimage(string image)
    {
        XmlDocument login = new XmlDocument();
        XmlDeclaration dec = login.CreateXmlDeclaration("1.0", null, null);
        login.AppendChild(dec);
        XmlElement root = login.CreateElement("CreateUser");
        login.AppendChild(root);
        try
        {

            string actFolder = Server.MapPath("~/iphoneimg/");
            string imgname = DateTime.UtcNow.ToString().Replace(" ", "").Replace("AM", "").Replace("PM", "").Replace("/", "").Replace("-", "").Replace(":", "") + ".png";

            Bitmap map;

            using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(image)))
            using (FileStream fs = File.Create(actFolder + imgname))
            {
                map = (Bitmap)Image.FromStream(stream);
                map.Save(fs, System.Drawing.Imaging.ImageFormat.Gif);
            }

            XmlElement root1 = login.CreateElement("uploaded");
            root1.InnerText = "true";
            root.AppendChild(root1);
            XmlElement root2 = login.CreateElement("path");
            root2.InnerText = "http://d8768157.u118.c6.ixwebhosting.com/iphoneimg/" + imgname;
            root.AppendChild(root2);

            return login;
        }
        catch (Exception ex)
        {
            throw ex;
        }

    }

this is the error i m getting

Invalid character in a Base-64 string.

Thanks

BHAVIK GOYAL

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:55:57+00:00Added an answer on May 23, 2026 at 12:55 am
    [WebMethod]
    public XmlDocument testuploadimage(string image)
    {
        XmlDocument login = new XmlDocument();
        XmlDeclaration dec = login.CreateXmlDeclaration("1.0", null, null);
        login.AppendChild(dec);
        XmlElement root = login.CreateElement("CreateUser");
        login.AppendChild(root);
        try
        {
    
            string actFolder = Server.MapPath("~/iphoneimg/");
            string imgname = DateTime.UtcNow.ToString().Replace(" ", "").Replace("AM", "").Replace("PM", "").Replace("/", "").Replace("-", "").Replace(":", "") + ".Png";
    
            byte[] imageBytes = Convert.FromBase64String(image.Replace(" ","+"));
            MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
    
            // Convert byte[] to Image
            ms.Write(imageBytes, 0, imageBytes.Length);
            System.Drawing.Image image2 = System.Drawing.Image.FromStream(ms, true);
            image2.Save(actFolder + imgname);
    
    
            XmlElement root1 = login.CreateElement("uploaded");
            root1.InnerText = "true";
            root.AppendChild(root1);
            XmlElement root2 = login.CreateElement("path");
            root2.InnerText = "http://d8768157.u118.c6.ixwebhosting.com/iphoneimg/" + imgname;
            root.AppendChild(root2);
    
            return login;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    
    }
    

    I got the answers…

    thanks to all….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using asp.net with .net 4.0 We want to allow users to upload
I want to upload a list of users from my work's LDAP server to
I simply want to upload an image to a server with POST. As simple
I have an asp.net page where I am letting the user upload an image
I am using c# .net compact framework 3.5 and I want to convert a
I am building a website using asp.net and this website will host users images
It's ok to upload image in file using codeigniter upload library with this example.
I am using Paperclip to upload an image to my Project model and I
i uploaded files into my server image folder. after upload want to display the
I want to use a temp directory that will be unique to this build.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.