OData Service: Invalid slug header for attachment.

2 posts, 0 answers
  1. Robert Kaucher
    Robert Kaucher avatar
    56 posts
    Member since:
    Oct 2010

    Posted 08 Jun 2013 Link to this post

    I am trying to upload a file via a service that implements OData. I cannot seem to set any additional headers on the upload control. I need to set a custom slug header.

    Here is the error I am receiving. Despite what it says the header format is below the error.

    Invalid slug header for attachment. Slug headers must be of the form "EntitySet,ItemId,Name".

    Here is how the headers should look:
        Slug: MyListTitle|1|mydocument.docx
  2. T. Tsonev
    T. Tsonev avatar
    2834 posts

    Posted 11 Jun 2013 Link to this post


    The latest version of the Upload supplies a reference to the XMLHttpRequest in the upload event.
    This will work only in non-IE browsers, as we use an IFRAME as a fallback in IE.

            function(e) {
              var xhr = e.XMLHttpRequest;
              if (xhr) {
                xhr.addEventListener("readystatechange", function(e) {
                  if (xhr.readyState === 1 /* OPENED */) {
                    xhr.setRequestHeader("Slug", "MyListTitle|1|mydocument.docx");

    Demo: http://jsbin.com/uwitun/1/edit

    I hope this helps.

    Tsvetomir Tsonev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top