Image 如何将单个图像多次上传(超过100次)?

Image 如何将单个图像多次上传(超过100次)?,image,image-processing,file-upload,for-loop,asp.net-mvc-4,Image,Image Processing,File Upload,For Loop,Asp.net Mvc 4,大家好,我正在MVC4上工作。我上传了一个图像文件,它保存在目标文件夹中,但现在我需要一个循环,以便图像保存100多次 这是我的密码 这是我的控制器: [HttpPost] public ActionResult Uploading(ImageModel model) { if (ModelState.IsValid) { string fileName = Gu

大家好,我正在MVC4上工作。我上传了一个图像文件,它保存在目标文件夹中,但现在我需要一个循环,以便图像保存100多次

这是我的密码

这是我的控制器:

     [HttpPost]

        public ActionResult Uploading(ImageModel model)
        {
            if (ModelState.IsValid)
            {     
                string fileName = Guid.NewGuid().ToString();
                string serverPath = Server.MapPath("~");
                string imagesPath = serverPath + "Content\\Images\\";
                string thumsise = Path.Combine(imagesPath, "Thumb" + fileName);

                ImageModel.ResizeAndSave(thumsise, fileName, model.ImageUploaded.InputStream, 80, true);

            }
            return View("Upload",model);
        }
这是我的索引页:

@using (Html.BeginForm("Uploading", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" }))
     {
         <input type="file" name="ImageUploaded" id="btnUpload" multiple="multiple" accept="image/*"  />
     <button type="submit"  id="Upload">Upload</button>
         <br />
}
@使用(Html.BeginForm(“上传”,“上传”,FormMethod.Post,新的{enctype=“multipart/formdata”}))
{
上传

}
你能帮我做这个吗?提前感谢。

写一个循环怎么样:

[HttpPost]
公共操作结果上传(ImageModel)
{
if(ModelState.IsValid)
{     
字符串imagesPath=Server.MapPath(“~/Content/Images”);
字符串文件名=Guid.NewGuid().ToString();

对于(var i=1;我为什么你要将同一个图像保存100次?实际上需要找到循环时间需要1或100次循环时间?仍然不明白为什么你需要100次谢谢多夫先生你在为我花费时间我得到了任务谢谢达林·迪米特罗夫先生为我工作很好的编码非常感谢你,谢谢你的回复
[HttpPost]
public ActionResult Uploading(ImageModel model)
{
    if (ModelState.IsValid)
    {     
        string imagesPath = Server.MapPath("~/Content/Images");
        string fileName = Guid.NewGuid().ToString();
        for (var i = 1; i <= 100; i++) 
        {
            string thumsise = Path.Combine(
                imagesPath, 
                string.Format("Thumb{0}_{1}", fileName, i)
            );
            ImageModel.ResizeAndSave(thumsise, fileName, model.ImageUploaded.InputStream, 80, true);
        }
        return View("Upload",model);
    }
}