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

delete the files using remove button from kendo ui fileupload plugin.

2 Answers 713 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 08 Mar 2012, 09:20 AM
HI Folks,

I am new to kendo ui and i am using the file upload plugin in my asp.net mvc application.Everything works like a dream.But i have one additional requirement. When i am uploading the file i am assigning a unique image guid to the image file and uploading and then returning to the callback function.Here is my code.

<script type="text/javascript">
    $(document).ready(function () {
        $("#attachments").kendoUpload({
            async: {
                saveUrl: '@Url.Action("UploadBlogImages", "Blog")',
                removeUrl: '@Url.Action("Remove", "Blog")',
                autoUpload: true
            },
            success: function (data) {
                var imageGuids = data.response;
                $.each(imageGuids, function (index, imageGuid) {
                    $('#form_uploadPic').append('<input type="hidden" value=' + imageGuid + 'name="ImgGuid">');
                });
            }
        });
    });
</script>
I need to delete the file when the user clicks the remove button but my problem is,
by default the remove button passes the name of the file(that was used at the time of upload)as the file name to delete.But I am
renaming the file before uploading to server.I am assigning a unique guid to file.I have returned that guid to the success function.How do i configure so that the remove button passes that guid to server for deleting the file.

Thanks,
S


2 Answers, 1 is accepted

Sort by
0
André
Top achievements
Rank 1
answered on 12 Mar 2012, 03:04 PM
Hi,

I am also interested in the solution of this problem.

How can I pass my own query parameter for each deletable item in the upload list?
I also cannot used the filename here.

Best,

André
0
T. Tsonev
Telerik team
answered on 15 Mar 2012, 09:44 AM
Hello,

Please consider using the remove event:

function onRemove(e) {
    var guids = [];

    for (var i = 0; i < e.files.length; i++) {
        guids.push(getGuid(e.files[i].name));
    }

    e.data = { imageGuids: guids };
}

You still need to maintain the association between file names and GUIDs somehow.

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Upload
Asked by
Sagar
Top achievements
Rank 1
Answers by
André
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or