Remove not working in Async uploads

2 posts, 0 answers
  1. Bryan
    Bryan avatar
    28 posts
    Member since:
    Oct 2014

    Posted 11 Mar Link to this post

    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? 

     

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 15 Mar Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top