Upload Files to OData Service
Environment
Product | Progress® Kendo UI® Upload for jQuery |
Operating System | Windows 10 64bit |
Visual Studio Version | Visual Studio 2017 |
Preferred Language | JavaScript |
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.
<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>