$("#<%=FileUpload1.ClientID %>").change(function () {<br /> document.getElementById("form1").submit();<br /> <%= ShowSelected() %>;<br /> });
Public Function ShowSelected() As String Dim totalfiles As Integer = 0 For Each postedFile As HttpPostedFile In FileUpload1.PostedFiles Dim fileName As String = System.IO.Path.GetFileName(postedFile.FileName) Session("selected") &= "<hr>" & postedFile.FileName & "</br>" Session("files") &= postedFile.FileName & vbCrLf lblPostedFiles.Text = Session("selected").ToString totalfiles += 1 Next progressbar2.Attributes("max") = totalfiles * 10 ProgressValue = totalfiles / 10 Return "" End Function Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim count As Integer = 0 For Each Filename As String In Request.Files Dim hFile As HttpPostedFile = TryCast(Request.Files(Filename), HttpPostedFile) 'Dim f As HttpPostedFile = Request.Files(Filename) hFile.SaveAs(Server.MapPath("~/Uploads/") & Filename) lblUploaded.Text &= "<hr>" & Filename & "</br>" progressbar2.Attributes("value") += ProgressValue count += 1 Next lblMsg.Text = String.Format("{0} files have been uploaded successfully.", count) End Sub
<%= ... %>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)