SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

Cancel Button and Post Processing Options
jshivok
#1 Posted : Wednesday, March 31, 2010 3:43:29 PM
Rank: Newbie

Groups: Registered

Joined: 3/30/2010
Posts: 8
Location: PA

Using the demo code to keep things simple.

When I click the cancel button, it appears this portion of the code runs..

 Protected Sub SlickUpload1_UploadComplete(ByVal sender As Object, ByVal e As UploadStatusEventArgs) Handles SlickUpload1.UploadComplete
            uploadPanel.Visible = False
            resultPanel.Visible = True

            If Not e.UploadedFiles Is Nothing AndAlso e.UploadedFiles.Count > 0 Then
                'Simulate post processing
                Dim status As NameValueCollection = New NameValueCollection

                For i As Integer = 0 To 100
                    status("percentComplete") = i.ToString()
                    status("percentCompleteText") = i.ToString() + "%"

                    'Update the progress context
                    e.Status.UpdatePostProcessStatus(status)

                    System.Threading.Thread.Sleep(100)
                Next i

                status("percentComplete") = "100"
                status("percentCompleteText") = "100 %"

                'Update the progress context as complete
                e.Status.UpdatePostProcessStatus(status, True)

                resultsRepeater.DataSource = e.UploadedFiles
                resultsRepeater.DataBind()

                resultsRepeater.Visible = True
            Else
                resultsRepeater.Visible = False
            End If
        End Sub

 

How do I determin the uploaded was terminated so any code I have in here does not run? I tried using e.Status.State but to no avail. Thanks.

Axosoft
#2 Posted : Friday, April 02, 2010 10:42:35 AM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

The sample simply runs postprocessing for any upload that had files. To run for only uploads that haven't been cancelled or errored, add a check like:

If Not e.Status.State = UploadState.Terminated Then

As a side note, once the upload goes into post processing, it can't be cancelled.

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.