title: ASP,NET MVC change a virtual path to a physical path when uploading a file
body: <p>I need to save the files somewhere else because the server that this application is getting full</p>
  
  <p>How would I change the virtual path to a physical path?</p>
  
  <p>This is my original controller</p>
  
  <pre><code>        [HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult Create(FormularioDoUploadViewModel formularioDoUploadViewModel)
          {
              if (ModelState.IsValid)
              {
                  List&lt;DetalhesDoArquivoViewModel&gt; detalhesDosArquivos = new List&lt;DetalhesDoArquivoViewModel&gt;();
  
                  for (int i = 0; i &lt; Request.Files.Count; i++)
                  {
                      var file = Request.Files[i];
  
                      if (file != null &amp;&amp; file.ContentLength &gt; 0)
                      {
                          var fileName = Path.GetFileName(file.FileName);
                          DetalhesDoArquivoViewModel detalhesDoArquivo = new DetalhesDoArquivoViewModel()
                          {
                              FileName = fileName,
                              Extension = Path.GetExtension(fileName)
                          };
  
                          detalhesDosArquivos.Add(detalhesDoArquivo);
                          var path = Path.Combine(Server.MapPath(@"~/App_Data/Upload/"), detalhesDoArquivo.Id + detalhesDoArquivo.Extension);
                          file.SaveAs(path);
                      }
  
                  }
  
                  formularioDoUploadViewModel.DetalhesDoArquivo = detalhesDosArquivos;
  
                  _uploadServices.AdicionarArquivo(formularioDoUploadViewModel);
  
                  return RedirectToAction("Index");
              }
  
              return View(formularioDoUploadViewModel);
          }
  </code></pre>
  
  <p>and I want to insert this path into the variable path:</p>
  
  <pre><code> var path = Path.Combine(Server.MapPath(@"C:\Users\bwm6\Desktop\uploads"), detalhesDoArquivo.Id + detalhesDoArquivo.Extension);
  </code></pre>