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

Client-side events like OnUpload do not provide file property values

1 Answer 70 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 02 Apr 2011, 08:06 PM
When using the OnUpload or OnSelect events I do not see the property values for the selected file(s). Instead, I get "undefined". This is true in both IE9 and FF4.

In fact, the code samples in the documentation do not work. See, "handling the OnUpload event" in the documentation at
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-upload-client-api-and-events.html#Files

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 04 Apr 2011, 09:26 AM
Hello Mike,

I've noticed an error in the OnUpload sample that can be the reason for your problem:
$.each(files, function(file) {
            if (file.extension != ".jpg") {
            // ...

The first parameter is assumed to be the file, but in reality it's the index of the current array element. The code should be:
$.each(files, function() {
            if (this.extension != ".jpg") {
            // ...

The samples for the Upload, Success, Error, Complete and Cancel events are also broken. The reason is that those events only fire in asynchronous mode. We will update the samples to include asynchronous configuration.

As a token of gratitude for your involvement your Telerik points have been updated.

I'm attaching a sample project with the applied fixes. Let us know if you still experience the problem.

Best Regards,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Upload
Asked by
Mike
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or