Hello everyone,
I am working on MVC 5, I want to upload and save images on application's local folder.
This is view,
After the upload, now getting 2 images on Controller,

I want to save Logo Images on this path
- string path = Server.MapPath("~") + "UploadedImages/PremiUserRegistration/LogoImage/" + file.FileName;
And, Tittile Images on this path
- string path = Server.MapPath("~") + "UploadedImages/PremiUserRegistration/TitlePicture/" + file.FileName;
I have tried,
- foreach (HttpPostedFileBase item in fileUpload)
- {
- if (item.ContentLength > 0)
- {
- HttpFileCollectionBase files = Request.Files;
- DataTable dt = new DataTable { Columns = { new DataColumn("Path") } };
- for (int i = 0; i < files.Count; i++)
- {
- HttpPostedFileBase file = files[i];
- string path = Server.MapPath("~") + "UploadedImages/PremiUserRegistration/LogoImage/" + file.FileName;
- //string path = Server.MapPath("~") + "UploadedImages/PremiUserRegistration/TitlePicture/" + file.FileName;
- if (file.FileName != "")
- {
- dt.Rows.Add(file.FileName);
- file.SaveAs(path);
- }
- }
- }
- }


Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 16, 2017, 8:37 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 16, 2017, 7:53 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 16, 2017, 7:57 PM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Feb 16, 2017, 8:04 PM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Feb 17, 2017, 8:03 PM EST