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 SontakkePosted Feb 17, 2017, 1:37 AM
Abhilash J APosted Feb 18, 2017, 1:03 AM
Abhilash J APosted Feb 17, 2017, 1:04 AM
Nitin SontakkePosted Feb 17, 2017, 12:57 AM
Nitin SontakkePosted Feb 17, 2017, 12:53 AM