Asp.Net Core MVC - Kendo Editor - FileBrowser - Upload not respecting returned file name

0 Answers 79 Views
Editor
Burton
Top achievements
Rank 1
Burton asked on 09 Aug 2021, 02:27 AM | edited on 09 Aug 2021, 02:36 AM

Hello,

I am using Kendo for Asp.Net MVC.  With an ImageBrowser on the Editor control, the name returned from the server (which is different from the file name uploaded) is respected, but for the FileBrowser, the returned name is ignored.  How does on get this to work?

    

<PackageReferenceInclude="Telerik.UI.for.AspNet.Core"Version="2021.2.616"/>

 

   
  @(Html.Kendo().Editor()
    .Name(Model.Id)
    .HtmlAttributes(new { style = "height:470px"aria_label = "editor" })
    .Tools(tools => tools
      .Clear()
      .Bold().Italic().Underline().Strikethrough().JustifyLeft().JustifyCenter()
      .JustifyRight().JustifyFull().InsertUnorderedList().InsertOrderedList().Outdent().Indent()
      .CreateLink().Unlink().InsertImage()
      .InsertFile()//.SubScript()//.SuperScript()//.TableEditing()
      .ViewHtml().Formatting().CleanFormatting()
      )
    .ImageBrowser(
      imageBrowser => imageBrowser
        .Transport(transport =>
        {
          transport.Read(r => r.Url($"/api/imageupload/read?franchiseId={Model.FranchiseId}"));
          transport.Create(c => c.Url("/api/imageupload/create"));
          transport.Destroy(d => d.Url("/api/imageupload/destroy"));
          transport.UploadUrl($"/api/imageupload/uploadurl?franchiseId={Model.FranchiseId}");
          transport.ImageUrl("/api/imageupload/imageurl?file={0}");
          transport.ThumbnailUrl("/api/imageupload/thumbnailurl");
        }
        )
        .Schema(schema => schema.Model(
            model => model.Fields(fields => fields
                .Name(name => name.Field("Name"))
                .Size(size => size.Field("Size"))
                .Type(type => type.Field("EntryType"))
                )
            )
        )
    )
    .FileBrowser(
      fileBrowser => fileBrowser
        .Transport(transport =>
        {
          transport.Read(r => r.Url($"/api/docupload/read?franchiseId={Model.FranchiseId}"));
          transport.Create(c => c.Url("/api/docupload/create"));
          transport.Destroy(d => d.Url("/api/docupload/destroy"));
          transport.UploadUrl($"/api/docupload/uploadurl?franchiseId={Model.FranchiseId}");
        }
        )
        .Schema(schema => schema.Model(
            model => model.Fields(fields => fields
                .Name(name => name.Field("Name"))
                .Size(size => size.Field("Size"))
                .Type(type => type.Field("EntryType"))
                )
            )
        )
    )
    .Value(Model.Value)
  )
Burton
Top achievements
Rank 1
commented on 09 Aug 2021, 02:33 AM

i may have been unclear -- for the ImageBrowser, after uploading an image, the new file name returned by the server is reflected in the images displayed.

for the FileBrowser, after uploading the original file name is displayed even if the server returns a different name.

Anton Mironov
Telerik team
commented on 11 Aug 2021, 05:06 PM

Hi Burton,

Thank you for sharing the code snippet and providing the needed details.

The pointed behavior is expected as the functionality of the FileBrowser is strongly connected with the file system.

The fastest route to getting you up and running is if you could provide a runnable, isolated, sample project where the issue is represented. Examining this project will let us replicate the issue locally and further troubleshoot it.

Looking forward to hearing back from you.

Kind Regards,
Anton Mironov
Burton
Top achievements
Rank 1
commented on 14 Aug 2021, 03:59 AM

see a project that reproduces the problem here:

https://github.com/burtonrodman/telerik-filebrowser-repro

  1. clone the repo, open in vscode or Visual Studio, start the project
  2. click the Insert File toolbar
  3. click Upload to upload a file
  4. after uploading, the new file entry name in the Insert File dialog should be "SERVERGENERATED"

currently, the new file entry retains the file name the user uploaded no matter what the server returns.

This works as expected for image uploads with the ImageBrowser.

Eyup
Telerik team
commented on 19 Aug 2021, 07:56 AM

Hi

Thank you for preparing the sample.

However, I am afraid we don't have the practice to download archives from third-party sources. Could you create a formal Support Ticket from your account and send the sample there?

Then, we will create a new working sample and send it back to you together with the solution.

No answers yet. Maybe you can help?

Tags
Editor
Asked by
Burton
Top achievements
Rank 1
Share this question
or