title: ASP.NET Validate Multiple FileUploads
body: <p>I want the user to upload 4 photos using FileUpload, and if any of them are empty I would like to display an error message. How can I validate that all of them are filled correctly?</p>
  
  <pre><code>&lt;div id="upload-area"&gt;
      &lt;div id="photo1"&gt;
          &lt;asp:FileUpload ID="PhotoUpload1" CssClass="photo-upload" ValidationGroup="PhotoUpload" runat="server" size="38" /&gt;
      &lt;/div&gt;
      &lt;div id="photo2"&gt;
          &lt;asp:FileUpload ID="PhotoUpload2" CssClass="photo-upload" ValidationGroup="PhotoUpload" runat="server" size="38" /&gt;
      &lt;/div&gt;
      &lt;div id="photo3"&gt;
          &lt;asp:FileUpload ID="PhotoUpload3" CssClass="photo-upload" ValidationGroup="PhotoUpload" runat="server" size="38" /&gt;
      &lt;/div&gt;
      &lt;div id="photo4"&gt;
          &lt;asp:FileUpload ID="PhotoUpload4" CssClass="photo-upload" ValidationGroup="PhotoUpload" runat="server" size="38" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>ASP.NET Validator</p>
  
  <pre><code>&lt;div id="upload-warning"&gt;
      &lt;asp:RequiredFieldValidator ID="PhotoUploadValidator" runat="server"
      ControlToValidate="PhotoUpload1" CssClass="upload-warning"&gt;
      &lt;img src="image/mobile/exclamation-mark.png" /&gt;
      &lt;span style="vertical-align: middle;"&gt;请上传四幅作品，您还需上传一幅作品。&lt;/span&gt;
      &lt;/asp:RequiredFieldValidator&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanks.</p>