New to Telerik UI for ASP.NET MVCStart a free 30-day trial

Copy and Paste Files in the Upload

Environment

ProductTelerik UI for ASP.NET MVC Upload
Progress Telerik UI for ASP.NET MVC versionCreated with the 2022.2.802 version

Description

How can I copy and paste a file into the Telerik UI for ASP.NET MVC Upload?

Solution

  1. Create a paste container and decorate it with the contenteditable HTML attribute.
  2. To paste a copied file, handle the paste event of the container.
  3. To insert the newly pasted file, use the DataTransfer object within the handler.
Index.cshtml
    @(Html.Kendo().Upload()
        .Name("files")
        .Async(a => a
            .Save("Async_Save", "Upload")
            .Remove("Async_Remove", "Upload")
            .AutoUpload(false)
        )
    )

    <div class="paste-area" contenteditable="true">
        Paste Area
    </div>

For the complete implementation of the suggested approach, refer to the following Telerik REPL example.

More ASP.NET MVC Upload Resources

See Also