New to Kendo UI for jQueryStart a free 30-day trial

Upload Files to OData Service

Environment

ProductProgress® Kendo UI® Upload for jQuery
Operating SystemWindows 10 64bit
Visual Studio VersionVisual Studio 2017
Preferred LanguageJavaScript

Description

How can I upload files to the OData service by using the Kendo UI Upload?

Solution

By default, the Upload uploads files as FileData. In order for the OData service to consume a file, the body of the sent request has to include the file buffer.

To allow the Upload to utilize the FileReader of the browser and send a request that satisfies the OData specification for Media Entities, set the useArrayBuffer option to true.

The useArrayBuffer option enables you to use the Upload in SharePoint 2013 and utilize its native REST service for the file upload mechanism.

html
<input type="file" name="files" id="photos" />
<script>
    $("#photos").kendoUpload({
        async: {
            saveUrl: "http://my-app.localhost/save",
            removeUrl: "http://my-app.localhost/remove",
            useArrayBuffer: true
        }
    });
</script>

See Also