fileBrowser.transport.read Object|String|Function

Options or URL for remote file retrieval.

Important: The value of transport.read is passed to jQuery.ajax.

Example - specify a read URL

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: "/filebrowser/read"
    }
  }
});
</script>

Example - specify read as a function

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: function(options) {
          // query async service, then call options.success or options.error
          options.success([
            { "name": "foo", "type": "d" },
            { "name": "bar.pdf", "type": "f", "size": 15289 }
          ]);
      }
    }
  }
});
</script>

fileBrowser.transport.read.contentType String (default: "application/x-www-form-urlencoded")

The content-type HTTP header sent to the server. Use "application/json" if the content is JSON. Refer to the jQuery.ajax documentation for further info.

Example

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: {
        /* omitted for brevity */
        contentType: "application/json"
      }
    }
  }
});
</script>

fileBrowser.transport.read.data Object|String|Function

Data to be send to the server. Refer to the jQuery.ajax documentation for further info.

Example - specify Data As Object

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: {
        data: {
          id: 42,
          name: "John Doe"
        }
      }
    }
  }
});
</script>

Example - specify Data As Function

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: {
        data: function() {
          return { id: 42, name: "John Doe" };
        }
      }
    }
  }
});
</script>

fileBrowser.transport.read.dataType String

The type of data that you're expecting back from the server. Commonly used values are "json" and "jsonp". Refer to the jQuery.ajax documentation for further info.

Example

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: {
        dataType: "json"
      }
    }
  }
});
</script>

fileBrowser.transport.read.type String

The type of request to make ("POST", "GET", "PUT" or "DELETE"), default is "POST". Refer to the jQuery.ajax documentation for further info.

Example

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: {
        type: "POST"
      }
    }
  }
});
</script>

fileBrowser.transport.read.url String|Function

The remote url to call when fetching list of items.

Example

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: {
        url: "/read"
      }
    }
  }
});
</script>

Example - specify Read URL As Function

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
  tools: [
    "insertFile"
  ],
  fileBrowser: {
    transport: {
      read: {
        url: function(params) {
          // build url
          return "/read?t=" + new Date().getTime();
        }
      }
    }
  }
});
</script>
In this article