title: How to check if FileUpload control is empty?
body: <p>I am using LINQ to retrieve data from the Database, the variable name relative to link is "service".</p>
  
  <p>the upDocument is the Id of a FileUpload control.</p>
  
  <p>The objective is to delete the old file, before uploading a new one.
  This is the code i came up with:</p>
  
  <pre><code>if ((service.image_url != null || service.image_url != "") &amp;&amp;
      (upDocument.FileName.Length != 0 || upDocument.PostedFile.ToString() != ""))
  {
       if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(service.image_url)))
       {
            File.Delete(System.Web.HttpContext.Current.Server.MapPath(service.image_url));
       }
  }
  </code></pre>
  
  <p>The problem that I have, is that although nothing is being loaded to the FileUpload the file is still being deleted. I made a breakpoint and checked it out... and contrary to what I was expecting the FileName.Length is not 0, and the postedFile.ToString() is not "".</p>
  
  <p>How can I make a correct validation?</p>