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

Clear method?

1 Answer 271 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 2
Dennis asked on 07 Aug 2013, 09:23 AM
I was very suprised to see so few methods in the documentation for the Kendo Upload, specially becouse I know it's been in the toolset a longer time. I basicly did my own UI for the upload. Most of the current buttons are hidden, I keep only the dropzone. The first problem I had is I couldnt just link methods to programaticly start an upload or open file choser dialog. I managed to get that functionality bi using their respective buttons click handlers.

One method I'm strugling with is clearing the files list programaticly. So I have implemented an item edit window with a picture upload. On select I managed to extract a file preview for the image before its sent to the server. If you click the save button for the window the form gets saved and the new photo uplodaed. If you click cancel however and open the same edit window for a different item. The old picture stayed in the upload. I want to clear it. Is there a way to do that? I have the file list hidden.

1 Answer, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 09 Aug 2013, 11:14 AM
Hello Dennis,

I am afraid that we do not have such API Method exposed that can help you programatically remove the file entry from the Upload widget.

The only possible way I can think of is to use the internal method for this job.

e.g.

var up = $('#uploadName').data().kendoUpload;
var allLiElementsToBeRemoved = up.wrapper.find('.k-file');
up._removeFileEntry(allLiElementsToBeRemoved );

Of course instead of removing all the files you can pick just these that you need.

Once again keep in mind that using internal methods is not something that we recommend and it can potentially break the logic for future releases.

I hope this helps.

Kind Regards,
Petur Subev
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
Dennis
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or