This is a migrated thread and some comments may be shown as answers.

Remove not working in Async uploads

1 Answer 186 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 11 Mar 2016, 03:34 PM

Hi, using an example from a different forum thread, I was able to use the async upload with a controller that saves the documents like so:

declaration:

$("#files").kendoUpload({
    async: {
        saveUrl: "api/document",
        removeUrl: "api/destroyDocument",
        autoUpload: true
    }

})

Upload (in vb):

    Public Async Function UploadDocument() As Task

        Dim root As String = HttpContext.Current.Server.MapPath("~/App_Data")
        Dim provider = New MultipartFormDataStreamProvider(root)

        Try

            Await Request.Content.ReadAsMultipartAsync(provider)
           
            For Each file As System.Net.Http.MultipartFileData In provider.FileData
                Dim fileInfo As FileInfo = New FileInfo(file.LocalFileName)
                If System.IO.File.Exists(file.LocalFileName) Then
                    FileIO.FileSystem.RenameFile(file.LocalFileName, Replace(file.Headers.ContentDisposition.FileName, """", ""))
                End If
            Next

        Catch ex As Exception

        End Try

    End Function

Which works fine. However, while I've declared the Remove function (based on the sample service example for the upload), it doesn't have any information in the files() even though the remove button properly hits the function:

 

   Public Function RemoveDocument(ByVal fileNames As String()) As ActionResult

 

There's nothing in the fileNames variable and seemingly nothing in the Request.Content. How can I get the list of files I'm trying to delete? 

 

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 15 Mar 2016, 08:43 AM

Hello Bryan,

The provided sample code looks correct. If the issue is still reproducing, you could send us an isolated runnable example here or in a support ticket, so we are able to inspect it.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Upload
Asked by
Bryan
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or