Telerik Forums
UI for ASP.NET Core Forum
0 answers
19 views

I am trying to add a Telerik Upload to a Telerik Grid Create option.  This is currently what I have. 

 


@(
Html.Kendo().Grid<EFCoreScaffoldSPACS.Models.Jobs>()
    .Name("grid")
       .Columns(columns =>
    {
        columns.Bound(p => p.JobId).Filterable(false).Visible(false);
        columns.Bound(p => p.LocationId).Filterable(false).Visible(false);
        columns.Bound(p => p.JobName).Title("Event");
        columns.Bound(p => p.StartDateTime).Title("Starts").Format("{0:MM/dd/yyyy}");
        columns.Bound(p => p.EndDateTime).Title("Ends").Format("{0:MM/dd/yyyy}");
        columns.Bound(p => p.Active);
 

        columns.Command(command => { command.Edit().Text(" ").HtmlAttributes(new { @class = "edit-location" });  }).HtmlAttributes(new
        {
            style = "text-align: center;"
        });
    })
         .Editable(e => e.Mode(GridEditMode.PopUp).TemplateName("Event"))
            .ToolBar(t =>
            {
                
                t.ClientTemplateId("GridToolbarTemplate");

            })

        .Resizable(resize => resize.Columns(true))
        .Sortable()
       .Scrollable(s => s.Enabled(false))
        .Pageable(pageable => pageable
            .ButtonCount(5)
            .Refresh(true)
            .PageSizes(new[] { 20, 50, 100, 500 }))
            .AutoBind(true)
        .Reorderable(reorder => reorder.Columns(true))
        .Filterable()
        .Events(ev => ev.DataBound("onDataBound"))
     .HtmlAttributes(new
     { style = "min-height: 600px; height: 100%;" })
        .ColumnMenu()
        .DataSource(dataSource => dataSource
             .Ajax()
             .PageSize(100)
             .Events(ev => ev.RequestEnd("onRequestEnd"))
             .Model(model => model.Id(p => p.JobId))
             .Read(read => read.Action("Read", "Events").Data("getMecFilterLocal"))
             .Create(update => update.Action("Create", "Events").Data("getFilters").Type(HttpVerbs.Post))
             .Update(update => update.Action("Update", "Events").Data("forgeryToken").Type(HttpVerbs.Post))
             .Destroy(update => update.Action("Delete", "Events").Data("forgeryToken").Type(HttpVerbs.Post))
    )
)

<script id="GridToolbarTemplate" type="text/x-kendo-template">
    <div class="toolbar topbar">
    <div class="box1" style="float:left;">

    @(Html.Kendo().DropDownList()
                                .Name("mecList")
                                @* .OptionLabel("- Pilot Group -") *@
                                .DataTextField("AirMne")
                                .DataValueField("PortalId")
                                .AutoBind(true)
                                .Events(e => e.Change("onMecFilterChange"))
                                .Events(e => e.DataBound("onMecDataBound"))
                                .HtmlAttributes(new { style = "width: 140px;" })
                                .DataSource(ds =>
                                {
                                    ds.Read("GetMecList", "App");
                                })
                                .ToClientTemplate()
                                )

        <span>
            <button class="add-locationadhoc k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-icon-button k-toolbar-button" type="button" role="button" aria-disabled="false" tabindex="0"  " style="" onclick="addlocationadhoc()"><span class="k-icon k-svg-icon k-button-icon" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.0272 14.9727 4.5 19.4998M21.5307 9.2195a.75.75 0 0 0 0-1.0603l-5.6869-5.6897a.75.75 0 0 0-1.0603 0L9.4116 7.8564s-2.6015-1.3003-5.3803.9422a.75.75 0 0 0-.061 1.1165L14.086 20.0298a.75.75 0 0 0 .5801.2159.749.749 0 0 0 .5449-.2937c.7866-1.0463 2.0222-3.1959.9478-5.3438z" fill="none"/></svg></span> </button>
        </span>

        <span class="custom-tb-btn">
           <button data-role="create" class="add-location k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-icon-button k-toolbar-button k-grid-add k-toolbar-tool" type="button" role="button" aria-disabled="false" tabindex="0" data-command="create" data-uid="eae6b89d-b018-478a-a593-0a1b6624fd16" style=""><span class="k-icon k-svg-icon k-svg-i-plus add-top-level k-button-icon" aria-hidden="true"><svg viewBox="0 0 512 512" focusable="false" xmlns="http://www.w3.org/2000/svg"><path d="M288 224V96h-64v128H96v64h128v128h64V288h128v-64H288z"></path></svg></span> </button>
        </span>

        <span class="custom-tb-btn">
            <button data-role="excel" class="export-location k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-icon-button k-toolbar-button k-grid-excel k-toolbar-tool" type="button" role="button" aria-disabled="false" tabindex="0" data-command="excel" data-uid="b4774ee4-ba1e-467c-8534-d9b5cea267ef"><span class="k-icon k-svg-icon k-svg-i-file-excel k-button-icon" aria-hidden="true"><svg viewBox="0 0 512 512" focusable="false" xmlns="http://www.w3.org/2000/svg"><path d="m288 304 64 112h-48l-48-84.5-31.5 52.5H256v32h-96l64-112-64-112h48l48 84 48-84h48l-64 112zm64-272H96c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V128l-96-96zm64 416H96V64h224v96h96v288z"></path></svg></span> </button>
        </span>

        </div>


        <div class="box3">
            <span class="k-searchbox k-input k-input-md k-rounded-md k-input-solid k-grid-search">
                <span class="k-input-icon k-icon k-i-search"></span>
                <input id="search-box" autocomplete="off" placeholder="Search..." title="Search..." class="k-input-inner">
            </span>
        </div>

    </div>

</script>


<script>


    function getFilters() {

        var Mec = $("#mecList").data("kendoDropDownList").value();
        var bannerImageUpload = $("#bannerImageUpload").data("kendoUpload");
        return {
            __RequestVerificationToken: kendo.antiForgeryTokens().__RequestVerificationToken,
            Mec: Mec,
            bannerImageUpload: bannerImageUpload,
        };
    }
</script>

This is my controller 


  [HttpPost]
        [ValidateAntiForgeryToken]
      
        public async Task<ActionResult> CreateAsync([DataSourceRequest] DataSourceRequest request, Jobs model, int Mec, IEnumerable<IFormFile> bannerImageUpload)
        {
            model.PortalId = Mec;
            model.CreateDate = DateTime.Now;
            model.CreateUser = _httpContextAccessor.HttpContext?.User?.Identity?.Name;

            try
            {
                _context.Jobs.Add(model);
                await _context.SaveChangesAsync();
                _toastNotification.AddSuccessToastMessage("Event Added");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Failed to add event");
                _toastNotification.AddErrorToastMessage("Failed: " + ex.Message, new ToastrOptions { ExtendedTimeOut = 0 });
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
I am going to store the file in the database to then be used to display on a page later 
Charlston
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 21 Oct 2026
1 answer
34 views

I am working with the Telerik Upload. To parse a excel file to then dump data into the database. That part seems to work the problem that is happening that I am trying to check the Success or Error on the return and it just going to the blank screen. With the content message or the json message. It is not attaching back to the event on the Telerik Upload. I am looking for a fix see code below.

 

 


 [HttpPost]
        public  ActionResult UploadContactTaskAsync(IEnumerable<IFormFile> files, int campaign, int mec)
        {

            try
            {
                var phoneOperatiors = new List<PhoneOperators>();
                Stream FileStream = null;
                IExcelDataReader eReader;

                if (files == null || !files.Any())
                {


                    //ContentResult contentResult = new ContentResult
                    //{
                    //    Content = "No files selected for upload.",
                    //    ContentType = "text/plain",
                    //    StatusCode = 400 // Bad Request
                    //};
                    return BadRequest(new { message = "No file selected or file is empty." });
                    //return Json(new { success = false, message = "No files selected for upload." });
                }
                else
                {



                    var file = files.FirstOrDefault();
                    if (file != null && file.Length > 0)
                    {


                        FileStream = file.OpenReadStream();

                        if(file.FileName.EndsWith(".xls"))
                        {
                            eReader = ExcelReaderFactory.CreateBinaryReader(FileStream);
                        }
                        else if(file.FileName.EndsWith(".xlsx"))
                        {
                            eReader = ExcelReaderFactory.CreateOpenXmlReader(FileStream);
                        }
                        else if (file.FileName.EndsWith(".csv"))
                        {
                            eReader = ExcelReaderFactory.CreateCsvReader(FileStream);
                        }
                        else
                        {
                            return Json(new { success = false, message = "Unsupported file format. Please upload an Excel or CSV file." });
                        }




                        var excelRecords = eReader.AsDataSet(new ExcelDataSetConfiguration()
                        {
                            ConfigureDataTable = _ => new ExcelDataTableConfiguration()
                            {
                                UseHeaderRow = true // To use first row as column names
                            }
                        });
                        eReader.Close();

                        if(excelRecords.Tables.Count > 0)
                        {
                            var dataTable = excelRecords.Tables[0];
                            foreach (DataRow row in dataTable.Rows)
                            {
                                var pilotId = row["PilotId"].ToString();
                              
                                bool existsInMec = _context.Pilot.Any(f => f.PilotId == pilotId && f.PortalId == mec);
                                bool existsInCampaign = _context.PhoneOperators.Any(f => f.PilotId == pilotId && f.ContactListId == campaign && f.PortalId == mec);
                                if (existsInMec && !existsInCampaign)
                                {
                                    PhoneOperators phoneOperator = new PhoneOperators
                                    {
                                        PilotId = pilotId,
                                        Active = true,
                                        ContactListId = campaign,
                                        PortalId = mec,
                                        CreateDate = DateTime.Now,
                                        CreateUser = _httpContextAccessor.HttpContext?.User?.Identity?.Name
                                    };
                                    phoneOperatiors.Add(phoneOperator);
                                }
                               
                                
                            }
                            _context.PhoneOperators.AddRange(phoneOperatiors);
                            _context.SaveChanges();
                        }


                    }
                }


                _toastNotification.AddSuccessToastMessage("Files uploaded successfully.");
                return Json(new { success = true, message = "Files uploaded successfully." });
            }
            catch (Exception ex )
            {
                _logger.LogError(ex, "Failed to upload files");
                _toastNotification.AddErrorToastMessage("Failed: " + ex.Message, new ToastrOptions { ExtendedTimeOut = 0 });
                return Json(new { success = false, message = ex.Message });
            }

 

 

 


    function  onSuccess(e) {
        e.preventDefault();
        if (e.response && e.response.success) {
            alert("File uploaded successfully.");
        } else {
            alert("File upload failed: " + (e.response ? e.response.message : "Unknown error"));
        }

        var uploadWindow = $("#uploadContactTaskWindow").data("kendoWindow");
        uploadWindow.close();
    }
    function onError(e) {
        e.preventDefault();
        var status = e.XMLHttpRequest.status;
        var statusText = e.XMLHttpRequest.statusText;
        var serverErrorMessage = e.XMLHttpRequest.responseText;
        if (serverErrorMessage) 
        {
            
        }
        var errorContainer = $("#errorContainer");
        e.errors.forEach(function (error) {
            errorContainer.append("<div class='alert alert-danger'>" + error + "</div>");
        });
    }


@using (Html.BeginForm("UploadContactTask", "PhoneOperators", FormMethod.Post, new { enctype = "multipart/form-data", id = "uploadContactTaskForm" }))
{
    <input id="Mec" type="hidden" name="Mec" value="@Model.PortalId"/>
    
    <div id="errorContainer">

    </div>

    <div class="container form-group">

        <div class="row">
            @( Html.Kendo().DropDownList()
                                            .Name("Campaign")
                                            .OptionLabel("- Campaign -")
                                            .DataTextField("ListName")
                                            .DataValueField("ContactListId")
                                            .AutoBind(true)
                                            .HtmlAttributes(new { style = "width: 400px;" })
                                                .DataSource(ds =>
                                            {
                                                ds.Read(read =>
                                                {
                                                    read.Action("GetMecContactList", "App").Data("getMecFilterLocal");
                                                })

                                                .ServerFiltering(true);
                                            })
                        )
         </div>

        <div class ="row" style="margin-top:5em">
            <div class="col-md-10">
                @(
                Html.Kendo().Upload()
                                    .Name("files")
                                    .Validation(validation => validation
                                        // Pass an array of allowed extensions (include the dot)
                                        .AllowedExtensions(new string[] { ".csv", ".xlsx" })

                                     )
                                     .Async(s => s
                                                .Save("UploadContactTask", "PhoneOperators").AutoUpload(false))
                                     .Events(e => e.Success("onSuccess").Error("onError"))

                )
            </div>
        </div>
        <div class="row" style="margin-top: 3em" >

            <button type="submit" class="btn btn-primary" id="uploadButton">Upload</button>

        </div>

     </div>
}
<style>
    .k-clear-selected,
    .k-upload-selected {
        display: none;
    }
</style>

Neli
Telerik team
 answered on 16 Oct 2026
2 answers
173 views

I'm attempting to use the Kendo Upload control asynchronously to an MVC controller, which passes the file to a WebApi controller.  The file is uploaded successfully, however when it returns to the MVC view, it reports that the file failed to upload with the error below.  We are using Azure B2C for authentication:

"Access to XMLHttpRequest at 'https... b2clogin.com...' (redirected from 'https//localhost:7074/Files/UploadFile') from origin 'https://localhost:7074' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."

Server response:

"Failed to load resource: net::ERR_FAILED"

The control is located in a partial view as part of a tab control on a CSHTML view.  Here is the code for the upload control:

<div class="row">
    <div class="col-md-8">
        @(Html.Kendo().Upload()
                .Name("uploadedFile")
            .Multiple(false)
            .Validation(v =>
            {
                v.AllowedExtensions(new string[] { ".csv" });
                v.MaxFileSize(3145728);
            })
            .Async(a => a
                .AutoUpload(false)
                .Save("UploadFile", "Files")
            )
            .Events(e =>
            {
    e.Upload("onFileUpload");
            })

         )
    </div>
    <div class="col-md-4">
    </div>

</div>

Here is the C# code for the MVC controller:

        [HttpPost]
        public async Task<ActionResult> UploadFile(IFormFile uploadedFile, string month, string year)
        {
            if (uploadedFile == null || uploadedFile.Length == 0)
                return BadRequest("No file uploaded.");

            var reportingPeriod = month + year;

            using (var content = new MultipartFormDataContent())
            {
                if (uploadedFile.Length > 0)
                {
                    var streamContent = new StreamContent(uploadedFile.OpenReadStream());
                    streamContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(uploadedFile.ContentType);
                    content.Add(streamContent, "file", uploadedFile.FileName);
                }

                using (var response = await _client.HttpClient.PostAsync("/api/Files/loadbackdatedmonthlytrueupfile/" + reportingPeriod, content))
                {
                    if (response.IsSuccessStatusCode)
                    {
                        // Kendo expects an empty string for success
                        return Content("");
                    }
                    else
                    {
                        return StatusCode((int)response.StatusCode, await response.Content.ReadAsStringAsync());
                    }

                }

            }
        }

 

Here is the code for the WebApi controller:

[HttpPost("loadbackdatedmonthlytrueupfile/{reportingPeriod}")]
public async Task<IActionResult> LoadBackdatedMonthlyTrueUpFile([FromForm] IFormFile file, string reportingPeriod)

{

     //other logic here

     return Ok(new { file.FileName, file.Length });

}

This is the info I received from Copilot:

This error is caused by trying to call the Azure AD B2C /authorize endpoint using an XMLHttpRequest (AJAX/fetch) from your frontend (https://localhost:7074). Azure AD B2C does not support CORS for this endpoint, so the browser blocks the request.
Root cause:
• The /authorize endpoint is designed for browser redirects, not AJAX/fetch/XHR.
• No CORS headers will ever be present on this endpoint, so preflight requests will always fail.
How to fix:
• Never use AJAX/fetch/XHR to call the /authorize endpoint.
• Always use a full-page redirect for authentication.
For example, set window.location.href to the login URL, or let the [Authorize] attribute and OIDC middleware handle it for you.

How can I configure this upload control to return to the view without the error (attaching screenshot)?

Austin
Top achievements
Rank 2
Iron
 updated answer on 20 May 2026
2 answers
124 views

I am working through Telerik's UI for ASP.NET Core tutorial on YouTube ... RPSTrackerASPCore ... and I am at the point where the instructor is walking us through adding an Upload component to the project. I am using a much more recent version of Kendo UI so I have to tweak some things to get them to work properly. So far that hasn't been a problem. But the Upload component has me stumped.

The VS projects are .Net 9.0.

I am using Telerik.UI.for.AspNet.Core (2026.1.325) and I am loading the JavaScript assets as ECMAScript modules. So here is the list of modules I am currently loading:

<script src="~/lib/kendo-ui/mjs/kendo.core.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.button.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.textbox.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.textarea.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.slider.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.tabstrip.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.dataviz.chart.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.grid.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.tilelayout.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.upload.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.draganddrop.js" type="module"></script>
<script src="~/lib/kendo-ui/mjs/kendo.aspnetmvc.js" type="module"></script>

And here is my component definition:

            @(Html.Kendo().Upload()
                .Name("files")
                .Multiple(true)
                .Async(a => a
                    .Save("SaveAttachmentsAsync", "Upload")
                    .AutoUpload(true)
                )
                .Validation(v => v.AllowedExtensions(new string[] { ".jpg", ".png", ".jpeg" }).MaxFileSize(10485760))
            )

And here is the inline JavaScript generated by the component:


<script type="module">kendo.syncReady(function(){jQuery("#files").kendoUpload({"async":{"autoUpload":true,"saveUrl":null},"multiple":true,"validation":{"allowedExtensions":[".jpg",".png",".jpeg"],"maxFileSize":10485760}});});</script>

I include this because I think it is odd that the async.saveUrl parameter is set to null.

I can use the "Select Files" button to select a file, and they do get added to the file list, but the autoupload functionality is not triggered. And there are no errors in the console. And the drag-and-drop functionality is not active. If I drag an acceptable file over the component the file (an image) just gets opened in a new browser tab.

I have breakpoints in my UploadController.SaveAttachmentsAsync method but they are never hit.

If I submit the form and break on the method that handles the page's form post request I DO see the file included in the request, so at least that part does actually work.

But none of the additional Kendo functionality seems to work. I thought perhaps I am missing an ECMAScript module that needs to be loaded but the documentation doesn't mention any. There are no errors in the browser console so there doesn't seem to be a JavaScript problem happening.

I did replace the modules with the standard vanilla kendo.all.min.js and kendo.aspnetmvc.min.js scripts but I get the exact same behavior.

So what am I missing?

Nikolay
Telerik team
 answered on 20 Apr 2026
1 answer
108 views

Hi, I'm referring to the article below:

https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/editors/upload/modes-of-operation#asynchronous-mode-fallback

In the article Asynchronous Mode Fallback is When Upload which is placed inside a form and configured for asynchronous operation.

I have done this, however after uploading some file (and failed since I didn't implement the controller) the form post still doesn't contain any Files.

Is there a specific to implement a fallback mechanism? a sample will be very helpful.

 

 

Ivaylo
Telerik team
 answered on 04 Aug 2025
0 answers
165 views
Is there a way to disable sending the token in the form? We would prefer to send it in the header.
Lenny
Top achievements
Rank 1
 asked on 23 Sep 2024
2 answers
441 views

Hello, I hope you are well.

I hope you can help me with this problem I have.

I am using the Kendo UI for JQuery Upload.

What I require is to upload an entire folder of TXT files, but I have a routine that validates that the name and content meet certain rules.

I apply these rules within the foreach loop (var file in files), because what is required is that if the file is valid it shows a text that it is valid, otherwise it shows a text that is not valid and for both options to continue processing the next file.

But by marking that file as erroneous, the controller is exited and the view is returned, thus leaving the processing of the rest of the files incomplete.

I share the code of the view and the controller, hoping you can give me some light.

View Code:

<div class="centered">
    @using Kendo.Mvc.UI
    <div>
        <div class="demo-section">
            @(Html.Kendo().Upload()
                .Name("files")
                .Async(a => a
                    .Save("ChunkSave", "Upload")
                    .Remove("Chunk_Upload_Remove", "Upload")
                    .AutoUpload(true)
                    .ChunkSize(11000)

                )
                .Multiple(true) // Enable multiple file selection
                    .Directory(true)
                    .DirectoryDrop(true)
                .Validation(validation =>
                {
                    //validation.MaxFileSize(20000000);
                })
                .Events(events =>
                {
                    events.Upload("onUpload");
                    events.Success("onUploadSuccess");
                    events.Error("onUploadError");
                    events.Select("onSelect");
                })
                .Messages(messages =>
                {
                    messages
                        .Select("Seleccionar archivos")
                        .DropFilesHere("Suelta archivos aquí para cargarlos")
                        .Remove("Eliminar")
                        .Retry("Reintentar")
                        .StatusFailed("Error")
                        .StatusUploaded("Terminado")
                        .StatusUploading("Cargando")
                        .UploadSelectedFiles("Cargar archivos")
                        .UploadFail("Error al procesar el archivo.")
                        .HeaderStatusUploaded("Terminado");
                })

            )
        </div>
    </div>
</div>

 

Controller Code:

public async Task<ActionResult> ChunkSave(IEnumerable<IFormFile> files, string metaData, string cve)
{

    int status = 0;
    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ChunkMetaData));


    MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(metaData));
    ChunkMetaData? somemetaData = serializer.ReadObject(ms) as ChunkMetaData;
    string path = String.Empty;

    if (files != null)
    {
        foreach (var file in files)
        {
            cap_dbt controller = new cap_dbt(_context);
            controller.ProcessFile(file, somemetaData.FileName, cve);
            status = controller.ProcessFile(file, somemetaData.FileName, cve);
            if (status == 1)
            {
                Upload(files, somemetaData.FileName);
            }
        }
    }


    if (somemetaData is null)
    {
        throw new Exception("No Metadata!");
    }

    Util.FileResult fileBlob = new Util.FileResult();
    fileBlob.uploaded = somemetaData.TotalChunks - 1 <= somemetaData.ChunkIndex;
    fileBlob.fileUid = somemetaData.UploadUid;
    fileBlob.warnings = Mensajes.msgLoadCsvWarning;
    fileBlob.message = "[" + somemetaData.FileName + "]\t";

    try
    {
        if (!fileBlob.uploaded)
        {
            fileBlob.message += "[ERROR]" + Mensajes.msgLoadCsvError;

            return StatusCode(500, fileBlob);
        }
        else if (status == -1)
        {
            fileBlob.uploaded = false;
            fileBlob.message += "[ERROR] " + Mensajes.msgLoadCsvError;
            throw new Exception(fileBlob.message); // <------- If I remove this line, it continues processing, but it no longer changes the file, it stays with the same name or empty.

        }

        if (fileBlob.warnings.Equals(""))
        {
            fileBlob.message += Mensajes.msgLoadCsvOk;
        }
    }

    catch (Exception ex)
    {
        Console.WriteLine(ex.ToString());
        return StatusCode(500, fileBlob);
    }
    finally
    {
        Mensajes.resetMsg();
    }

    return Json(fileBlob);
}

The following line was created to manipulate the Upload properties:
Util.FileResult fileBlob = new Util.FileResult();

I know what I can do if my file is not valid:
fileuid=""
success = false

But I see that if success is false it stops processing all the files and exits and goes to view.
Ashapura Softech
Top achievements
Rank 1
Iron
 answered on 29 May 2024
1 answer
396 views

Hello Telerik,

I am using the Kendo Upload Control with Async AutoUpload set to "true".  In version 2023.3.1114, when using "Select File" to upload a document the control works perfectly.  Dragging and dropping a file onto the control also works perfectly. 

After upgrading to 2024.1.130 using "Select File" to upload a document does not work, but dragging and dropping a file does work to upload a document.

Can you please advise me as to what I am doing wrong.  I am using jQuery v3.7.0.

My client side code looks like the following:
@(Html.Kendo().Upload()
		.Name("uplCtrl")
		.HtmlAttributes(new { aria_label = "files", title = "Select file to upload" })
		.Multiple(false)
		.Messages(m => m.Select("Select file...")
		.DropFilesHere("Drop file here to upload"))
		.ShowFileList(false)
		.Async(a => a
			.Save("UploadSave", "Vendors")
			.AutoUpload(true)                                        
		)
		.Validation(validation =>
		{
			validation.AllowedExtensions(new string[] { "pdf", "docx", "xlsx", "zip" });
			validation.MaxFileSize(52428800);
		})
		.Events(e => e
			.Error("onUploadError")
			.Complete("onUploadSuccess")
			.Upload("onUpload")
		)
	)

Ivan Danchev
Telerik team
 answered on 21 Mar 2024
1 answer
235 views

Razor code-behind method: I made the razor method as simple as possible, just to see if we could get in there / or hit onpostUploadFile
        public async Task<ActionResult> OnPostUploadFile(IEnumerable<IFormFile> files, string metaData)
        {
            AllowedExtensions = new string[] { "fpd", "pdf" };

            return Page();
        }

Razor page :

@addTagHelper *, Kendo.Mvc
<div>
    <div class="demo-section">
        <kendo-upload name="files">
            <async auto-upload="true" save-url="@Url.Action("Upload","UploadFile")" chunk-size="11000" />
            <validation max-file-size="20000000" />
        </kendo-upload>
    </div>
</div>

The issue is i am not able to hit the hander from the razor page when i pass the url to <async save-url="">, Despite many efforts, the handler specified in the save-url attribute doesn't seem to be hit and returns 404.

Not Working: 

1. save-url: "/Upload/UploadFile",

2. save-url="./Upload?handler=UploadFile"

I also found Forum where it discussed the same problem but that didn't help us :https://www.telerik.com/forums/upload-using-tag-helpers

 

Mihaela
Telerik team
 answered on 17 Jan 2024
1 answer
572 views

Hello!

I am trying to add a <kendo-upload> tag onto the toolbar of a kendo grid using TagHelper and ASP.NET Core

Though I am struggling with figuring out how to do this,  I have followed this template: https://demos.telerik.com/aspnet-core/grid/toolbar-template to not much success. 

My goal is to simply add a file upload option to upload an excel file to populate the fields of a grid!

Any ideas on how to progress?

Thank you!

But I am still struggling

Mihaela
Telerik team
 answered on 08 Dec 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?