using System.Drawing;
using System.IO;
//teeme FileUpload failist Image
byte[] image = new byte[0];
if (this.FileUploadCVPicture.HasFile) //midagi on ülesse laetud
{
if (FileUploadCVPicture.PostedFile.ContentType.Contains("image/")) //on tegu pildiga
{
//loeme striimist asja pildiks
Stream iplit = FileUploadCVPicture.PostedFile.InputStream;
System.Drawing.Image pilt = Image.FromStream(iplit); //pilt olemas
}
}
//Kui pilt vaja bitijadaks pöörata
using (MemoryStream ms = new MemoryStream())
{
pilt.Save(ms, System.Drawing.Imaging.ImageFormat.Png); // salvestame PNG tüüpi antud juhul
image = ms.ToArray(); //bitijada olemas
}
Blogged with the Flock Browser