Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
create directory in asp.net mvc
kainat younas
Jul 12 2017 8:19 AM
291
Reply
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Creating a tab in a asp.net
Bundling issue in asp.net web site