title: System.IO.DirectoryNotFoundException
body: <p>I am hoping one of you will be able to kindly assist me with an error I am receiving in my code. Please note, I have limited experience, so an explanation would be appreciated! :)</p>
  
  <p>When I clicked on my  "Add New Product" (btnSubmit), I receive the following error message: </p>
  
  <blockquote>
    <p>An exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll but was not handled in user code</p>
  </blockquote>
  
  <p>Code:
               private void SaveProductPhoto()
               {
                   if (PPhoto.PostedFile != null)
              {
                  string PName = PPhoto.PostedFile.FileName.ToString();
                         string fileExtension =           System.IO.Path.GetExtension(PPhoto.FileName);</p>
  
  <pre><code>                 }
              //Save images into Images folder
              else
              {
                  PPhoto.SaveAs(Server.MapPath("~/PImg/" + PName));
  
              }
          }
      }
  </code></pre>
  
  <p>My code failed at this line :</p>
  
  <pre><code>UploadProductPhoto.SaveAs(Server.MapPath("~/ProductImages/" + PName));
  </code></pre>