mardi 21 avril 2015

Upload image from Bitmap to server as png

I am trying to upload a System.Drawing.Bitmap variable I have in my C# winform application as a .png image on my server. Right now I know how to save a Bitmap as a .png file and then upload it to my server.

//Save bitmap variable as .png
bitmap.Save("img_1.png", ImageFormat.Png);

And then upload that to my server like so:

using (WebClient client = new WebClient())
{
    client.Credentials = new NetworkCredential("FTP_username",
        "FTP_password");
    client.UploadFile("http://ift.tt/1QgnQBz",
        "img_1.png");
}

How could I upload the Bitmap bitmap variable as a .png file on my server directly, without having to save it as a new .png file locally first ?

Aucun commentaire:

Enregistrer un commentaire