Save File on Physical Path

0

I'm uploading an image I get via form using C # ASP.NET. My code is working like this:

[HttpPost]
    public ActionResult UploadFile(HttpPostedFileBase file)
    {
        try
        {
            if (file.ContentLength > 0)
            {
                string _FileName = Path.GetFileName(file.FileName);
                string _path = Path.Combine(Server.MapPath("~/UploadedFiles"), _FileName);
                file.SaveAs(_path);
            }
            ViewBag.Message = "File Uploaded Successfully!!";
            return View();
        }
        catch(Exception e)
        {
            ViewBag.Message = "File upload failed!!";
            return View(e.Message);
        }
    }

But the directory he is saving is virtual (folder created within the project). Can I save this image to a physical directory (folder that is in another location that is not inside the project)?

    
asked by anonymous 29.11.2017 / 18:22

0 answers