title: Could not find a part of the path C# asp.net, path is there
body: <p>Lost.</p>
  
  <p>I have this code:</p>
  
  <pre><code>public ActionResult UploadCV(string userId, HttpPostedFileBase cvfile)
      {
          if (cvfile != null &amp;&amp; cvfile.ContentLength &gt; 0)
          {                
              var bareFilename = Path.GetFileNameWithoutExtension(cvfile.FileName);
              var fileExt = Path.GetExtension(cvfile.FileName);
              //save to dir first
              var path = Path.Combine(Server.MapPath("/App_Data/userfiles/"),
                                      userId + "/");
              var dir = Directory.CreateDirectory(path);
              cvfile.SaveAs(path);
              //save to db..
              var user = Ctx.Users.FirstOrDefault(x =&gt; x.Id == userId);
              user.CvLocation = "/App_Data/userfiles/" + userId + "/" + bareFilename + fileExt;
              user.CvUploadDate = DateTime.Now;
              Ctx.SaveChanges();
  
          }
          return RedirectToAction("Index", "Settings", new { area = "" });
      }
  </code></pre>
  
  <p>on the line:</p>
  
  <pre><code>cvfile.SaveAs(path);
  </code></pre>
  
  <p>I get the error </p>
  
  <pre><code>Could not find a part of the path 
  'C:\Users\me\big\ol\path\App_Data\userfiles\4cf86a2c-619b-402a-80db-cc1e13e5288f\'.
  </code></pre>
  
  <p>If I navigate to the path in explorer, it comes up fine.</p>
  
  <p>What I am trying to solve is sort the user uploads by their unique GUID they have in the db. I wants the folder 'userfiles' to have a folder name of the users guid, and in that folder I have 'mycoolpic.png'</p>
  
  <p>Any idea what I am doing wrong here?</p>