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
kainat younas
NA
26
4.9k
create directory in asp.net mvc
Jul 12 2017 8:19 AM
i want to create directory for save image.. my code is that
[HttpPost]
public ActionResult Index(HttpPostedFileBase file)
{
if (file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Assets/Upload/Users/Profiles"), fileName);
file.SaveAs(path);
}
return RedirectToAction("Index");
}
when i use this line with else statement it is not work
else
{
Directory.CreateDirectory(Server.MapPath("~/Assets/Upload/Users/Profiles"));
}
iwant to know how i can set my code please help me
Reply
Answers (
1
)
Creating a tab in a asp.net
Bundling issue in asp.net web site