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

Removing a failed upload

9 Answers 483 Views
Upload
This is a migrated thread and some comments may be shown as answers.
ANDREW
Top achievements
Rank 1
ANDREW asked on 17 Sep 2012, 08:00 PM
Upload multiple files - in async mode.
A)
When an upload did not complete due to a server error, the uploaded file is being displayed in the file list with the "Retry" button.
When multiple files are uploaded, it is very easy to overlook the file that has not been uploaded yet.

is there a way to provide different styling for unfinished vs finished files?

B)
When number of files to be uploaded is limited to a predefined number MAX_FILES 
(I use the following code from the forum: ($(id).parent().children('input[type=file]:not(' + id + ')').length >= MAX_FILES)
to determine the number of files in the list)

The files that are in the list but not yet uploaded get counted as well.
Is there a way to provide the user an option to remove the entry (the entry waiting for "retry") from the list?

Thanks
Andrew.

9 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 1
answered on 08 Oct 2014, 01:41 PM
Can a Telerik Admin please reply to this?  Thanks.
0
Dimiter Madjarov
Telerik team
answered on 08 Oct 2014, 03:06 PM
Hello Bob,


At the moment by design unsuccessfully uploaded files cannot be removed. Clicking the remove button performs a request to the remove action, which is not desired since there is no file to be removed on the backend. You could use the new template functionality of the widget and add a custom button, that will only remove the list item.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bob
Top achievements
Rank 1
answered on 08 Oct 2014, 03:13 PM
Dimiter, is there a way to display a "Remove" button to users for failed downloads?  I see a screenshot with a remove link for failed downloads on the page below but am missing how to implement.

http://www.telerik.com/kendo-ui/upload
0
Dimiter Madjarov
Telerik team
answered on 08 Oct 2014, 03:44 PM
Hello Bob,


There is cancel icon displayed, while the file is uploading. It will cancel the upload and remove the uploaded file. When the upload has failed, only a retry icon is displayed at the moment.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bob
Top achievements
Rank 1
answered on 08 Oct 2014, 03:50 PM
Hi, I've attached a screenshot from below URL showing the functionality I am trying to implement.  Can you please let me know how this functionality is enabled with delete file icon for failed uploads?

http://www.telerik.com/kendo-ui/upload
0
Bob
Top achievements
Rank 1
answered on 08 Oct 2014, 09:53 PM
This hack seems to work:

var removeButtonHtml = "<button class=\"k-button k-button-bare k-upload-action\" type=\"button\"><span title=\"Remove\" class=\"k-icon k-i-close k-delete\"></span></button>";
var retryButtons = $('.k-retry').parent();
 
// hack: try to show "remove" buttons for failed downloads as this functionality not provided by kendo out-of-box
// if this fails, we don't want to hold up user
try{
    retryButtons.each(function () {
        if ($(this).parent().html().indexOf(removeButtonHtml) === -1)
        {
            $(removeButtonHtml).insertAfter($(this));
        }
    });
}
catch(e){}
0
Dimiter Madjarov
Telerik team
answered on 09 Oct 2014, 07:55 AM
Hello Bob,


I am glad that the issue is resolved.

Let me know if you have any other Kendo UI Upload related question. I wish you a great day!

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Canton
Top achievements
Rank 1
answered on 12 May 2017, 01:08 PM

Has any functionality been added yet that would remove these failed files?

I am trying to enter the uploaded file name and location into my database when a user submits a form that includes an upload control. 

The problem is, it is inserting those failed files as well even though they did not get uploaded to the server, but because they remain in the list of files. Is there a way to distinguish against which files were successful so I am only inserting those?

0
Dimitar
Telerik team
answered on 17 May 2017, 10:41 AM

Hello Canton,

You can remove files which contain errors and which have not passed validation by subscribing to the error event. You can find a working example in this article.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Upload
Asked by
ANDREW
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Canton
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or