1<script language="JavaScript"Type="Text/javascript">2 //Check upload file size and get file name3 function Filechange (target) {4 5 varFileSize =0;6 7 varFilePath =Target.value;8 9 varFileSystem =NewActiveXObject ("Scripting.FileSystemObject");Ten varFile =Filesystem.getfile (filePath); OneFileSize =file. Size; A - - varsize = fileSize/1024x768; the if(Size >10000) { -Alert"attachments cannot be larger than 10M"); - } - vararr = Filepath.split ("\\"); + if(Target.id = ="FileUpload1") { -document.getElementById ('Label8'). InnerHTML = size+"KB"; + A at$("#Label9"). HTML (showdate ()); LinkButton1 -$("#LinkButton1"). HTML (Arr[arr.length-1]); -}Else { -document.getElementById ('Label10'). InnerHTML = size+"KB"; - -$("#Label11"). HTML (showdate ()); in$("#LinkButton2"). HTML (Arr[arr.length-1]); - } to + } -</script>
1<tr id="trrow6"runat="Server">2<TD colspan="4"style="Background-color: #C0C0C0">3<asp:label runat="Server"text="Uploading Attachments"Width="301px"></asp:Label>4</td>5</tr>6 7<tr>8<tdclass=" Left"style="width:167px">9 Annex 1:Ten</td> One<td> A<asp:fileupload id="FileUpload1"Onchange="Filechange (This)"runat="Server"Width="181px"style="Display:none"/> -<input id="Button3"Type="Button"Value="Uploading Attachments"onclick="document.getElementById (' FileUpload1 '). Click ();"/> - the<asp:linkbutton id="LinkButton1"runat="Server"causesvalidation="false"Commandname="Download" -text="'onclick="LinkButton1_Click"></asp:LinkButton> -<asp:label id="Label14"runat="Server"text=""visible="false"></asp:Label> -</td> +<td><asp:label id="Label8"runat="Server"></asp:Label></td> -<td><asp:label id="Label9"runat="Server"></asp:Label></td> +</tr> A<tr> at<tdclass=" Left"style="width:167px"> - Annex 2: -</td> -<TD > - -<asp:fileupload id="FileUpload2"runat="Server" inOnchange="Filechange (This)"Width="179px" -style="Display:none" to/> +<input id="Button2"Type="Button"Value="Uploading Attachments"onclick="document.getElementById (' FileUpload2 '). Click ();"/> -<asp:linkbutton id="LinkButton2"runat="Server"causesvalidation="false"Commandname="Download" thetext="'onclick="LinkButton1_Click"></asp:LinkButton> *<asp:label id="Label26"runat="Server"text=""visible="true"></asp:Label> $<a title="Test"></a>Panax Notoginseng</td> -<td><asp:label id="Label10"runat="Server"></asp:Label></td> the<td><asp:label id="Label11"runat="Server"></asp:Label></td> +</tr>
ASP. NET uses jquery to determine the size and type and name of the FileUpload upload file