[英]I want to insert two different sizes of images using single File upload Using ASP.NET C#
[英]I want to Add multiple images and other data at a time using WCF in asp.net and C#
我是WCF
新手,我想Upload Multiple Images at a time
從客戶端使用WCF
Upload Multiple Images at a time
,
場景是:我有20個問題,每個問題可能有0到2張圖像,所以我必須請求服務保存所有數據,有什么可能的方法來解決問題?,
我想從最近兩天開始,但是我一次只能插入一張圖片...。
您必須為每個圖像添加流轉換並將詳細信息添加到列表中。
在客戶端。
Stream stream = (Stream)openDialog.File.OpenRead();
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, (int)stream.Length);
BitmapImage bmi = new BitmapImage();
using (MemoryStream ms = new MemoryStream(bytes))
{
bmi.SetSource(ms);
newRow.Thumbnail = bmi;
}
在您的服務方面
string filePath = ConfigurationManager.AppSettings.Get("ImageUploadPath");
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
filePath = filePath + "\\" + picture.FileName + "." + picture.FileType;
if (picture.FileName != string.Empty)
{
fileStream = File.Open(filePath, FileMode.Create);
writer = new BinaryWriter(fileStream);
writer.Write(picture.FileStream);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.