ASP. NET uses jquery to determine the size and type and name of the FileUpload upload file

Source: Internet
Author: User

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&LT;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> -&LT;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.