Greetings. I am getting the following error while uploading a file with Kendo upload. Code works fine at local. But it gives this error on the server.
Error:
Client-Side Code:
$("#batchFile").kendoUpload({
async: {
saveUrl: '/DijitalArsiv/UploadFile/',
autoUpload: false
},
upload: function (e) {
if (uploadFileNode.isMainFolder) {
realPath = realPath + "\\" + personelID
}
e.data = { "id": uploadFileNode.id, "path": realPath, "isMainFolder": uploadFileNode.isMainFolder, "type": uploadFileNode.spriteCssClass };
},
select: function (e) {
if (e.files.length != 0) {
$.each(e.files,function (index, value) {
var filtredValue = acceptedFileTypes.filter(x => x == value.extension)
if (filtredValue.length == 0) {
e.preventDefault();
$("#message-alert").html("Sadece '.pdf', '.jpg', '.png', '.jpeg', '.docx', '.xlsx' türünde dosyalar yükelenebilir. Lütfen yüklediğiniz dosyların türünü kontrol edin.")
kendoWindowMessageAlertModal.data("kendoWindow").content($("#message-alert").html()).center().open();
}
})
}
},
success: function (e) {
if (e.response.Status) {
getTreeView().append([{ id: e.response.ID, text: e.response.FileName, spriteCssClass: e.response.Type, UnicParentCode: nodeToUploadParent.UnicParentCode, isDraggable: true, isDroppable: true, hasChildren: false, isEditable: false, isMainFolder: false }], nodeToUpload)
updateBackupTree();
} else {
e.preventDefault();
}
},
multiple: true,
batch: true,
localization: {
cancel: "İptal",
dropFilesHere: "Dosyalarınızı Buraya Sürükleyebilirsiniz!",
remove: "Sil",
retry: "Tekrar Dene!",
select: "Dosya Seç",
statusFailed: "Yükleme Başarısız!",
statusUploaded: "Yükleme Başarılı!",
statusUploading: "Yükleniyor...",
uploadSelectedFiles: "Yükle"
}
});
Server-side Code:
[HttpPost]
public JsonResult UploadFile(HttpPostedFileBase batchFile, int? id, string path, bool isMainFolder,string type)
{
}
Hi,
The exception you get alerts you that the setup endpoint (the controller's action) does not exist and IIS cannot reach it. If that works locally and not in production or remote you should examine why the endpoint is not valid for the published application.
Note that with MVC it would be better to use the @Url.Action helper so that you have the URL generated based on the hosted application.
Or do I need to add something related to that in the web config?