File upload with Progressbar in web application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Malathi
    New Member
    • Mar 2012
    • 31

    File upload with Progressbar in web application

    Hi,

    Ive a vb.net web app in which one of the Content pages has asp upload control. The file to be uploaded has 2000 records which are in server. If this file is uploaded via this control, all the 2000 files will be uploaded. Its like by uploading single file into the control, we are uploading mulitple files. During the uploading I need a progress bar with current status like number of files getting updated. Without Ajax I need to do this. Any help is much appreciated.

    Thanks,
    Malathi
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    I would use jQuery to accomplish this. Using jQuery or AJAX is your only choice (or some Flash controls)

    Comment

    • Malathi
      New Member
      • Mar 2012
      • 31

      #3
      Thanks for the reply. The following code does the job but its showing the script only once once and it merges all the earlier inputs.
      Code:
       For i As Integer = 0 To 20
                     If i Mod 3 = 0 Then
                      Dim strmsg As String = Convert.ToString(i) & " files are uploaded!"
                      Dim a As String = "<script  language='javascript' type='text/javascript'>" & ControlChars.CrLf & " function Warning()  { " & ControlChars.CrLf & " Win_Warning = window.open('','Win_Warning','top=50,screenY=50,center=yes,width=100,height=100,scrollbars=no,scrollbar=no,menubar=no'); " & ControlChars.CrLf & " Win_Warning.document.write('" & strmsg & "'); Win_Warning.focus();" & ControlChars.CrLf & "  setTimeout('Win_Warning.close()',2000);" & ControlChars.CrLf & "} " & ControlChars.CrLf & "  </script>"
                      Dim myscript As String = "myscript" + Convert.ToString(i)
                      Page.ClientScript.RegisterClientScriptBlock(GetType(Page), myscript, a, False)
                      Dim script1 As String = "script" + Convert.ToString(i)
                      ClientScript.RegisterClientScriptBlock(GetType(Page), script1, "<script language='javascript'>Warning();</script>", False)
      End if
      Next
      The output for this code in new window is,
      3 files are uploaded!
      6 files are uploaded!
      .
      .
      18 files are uploaded!
      And the window automatically closes after 2 secs.Some error in using clientscript method. If you identify please let me know.

      Comment

      Working...