This question is locked. New answers and comments are not allowed.
For some reason the code below seems to have stopped working for me and when the page loads I get
an error as follows:
"Microsoft JScript runtime error: 'onUpload' is undefined"
as you can see the functions do exist and if I View Source on the page, the scripts are available?
Any help would be greatly appreciated :)
Neil
@{ ViewBag.Title = "ImageUploader"; Layout = "~/Views/Shared/LetsPoseLayout.cshtml";}<div id="response"></div><p> Add images from your computer using the <b>Select</b> button below.<br /> <span class="footnote">(You can browse for more than 1 image before uploading the files)</span></p>@(Html.Telerik().Upload() .Name("attachments") .Multiple(true) .Async(async => async .Save("Save", "Image") .Remove("Remove", "Image") .AutoUpload(false)) .ClientEvents(events => events .OnSuccess("onSuccess") .OnError("onError") .OnUpload("onUpload") ) )<script type="text/javascript"> $(document).ready(function () { $('#response').hide(); }); function onSuccess(e) { $('#response').attr({ class: 'success' }) .html('You have successfully upload new images to your account') .show(); } function onError(e) { $('#response').attr({ class: 'error' }) .html(e.XMLHttpRequest.responseText) .show(); e.preventDefault(); } function onUpload(e) { // Array with information about the uploaded files var files = e.files; // Check the extension of each file and abort the upload if it is not .jpg $.each(files, function () { if (this.extension != ".jpg") {// $('#response').attr({// class: 'error'// })// .html("Error - Only files of type .jpg can be uploaded")// .show(); e.preventDefault(); return false; } }); }</script>