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

[Solved] Suppress: Error! Upload failed. Unexpected server response - see console.

2 Answers 79 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.
Greg Robbins
Top achievements
Rank 1
Greg Robbins asked on 22 Jul 2011, 05:57 AM
Implementing server side validation for file size and file type, and using return Content("Error"); 
if there's an issue.  

Then in the OnError client event I'm displaying my error message.

However, after my error message displays another one pops up:
Error! Upload failed. Unexpected server response - see console.
Prevent this page from creating additional dialogs.


I've also tried the onComplete event with the same results.

Can I prevent the Telerik error from displaying?


Thanks for your assistance.

2 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 22 Jul 2011, 12:32 PM
Hi Greg,

The documentation isn't particularly clear about this, but you can prevent the error message by cancelling the event:

<script type="text/javascript">
    function onError(e) {
        // Array with information about the uploaded files
        var files = e.files;
 
        if (e.operation == "upload") {
            alert("Failed to uploaded " + files.length + " files");
        }
 
        // Suppress default error message
        e.preventDefault();
    }
</script>

I hope this helps.

Regards,
Tsvetomir Tsonev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Greg Robbins
Top achievements
Rank 1
answered on 22 Jul 2011, 06:00 PM
Thanks, that's exactly what I needed!

I didn't find that line in the documentation.

Tags
Upload
Asked by
Greg Robbins
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Greg Robbins
Top achievements
Rank 1
Share this question
or