public string ImportKML(Stream stream) { MultipartParser parser = new MultipartParser(stream); XmlDocument doc = new XmlDocument(); var filename = parser.Filename; string fileContent = System.Text.Encoding.UTF8.GetString(parser.FileContents); return fileContent; }
public string ImportImage(Stream stream) { string tempPath = "/Upload"; string path = HttpContext.Current.Server.MapPath(tempPath); string filename = Guid.NewGuid() + ".png"; string localPng = path + "\\" + filename; MultipartParser parser = new MultipartParser(stream); using (var ms = new MemoryStream(parser.FileContents)) { Image img = Image.FromStream(ms); img.Save(localPng, ImageFormat.Png); } return tempPath + "/" + filename; }