TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhilash J A
537
2.4k
597.1k
How to use Server.MapPath to go two folder using for loop?
Feb 17 2017 12:13 AM
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);
}
}
}
}
How can I do this? Please help me...
Reply
Answers (
5
)
Binding Combobox selection to Togglebutton IsChecked propert
how to select two columns from DBContext linq c#?