Skip to content

Commit

Permalink
Make XHR defualt option to upload a file. Documentation update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Samsel authored and mlewand committed Feb 1, 2018
1 parent 806636a commit 4e0866c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions plugins/filebrowser/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@

if ( uploadFile.call( sender, evt ) ) {
// Use one of two upload strategies, either form or XHR based (#643).
if ( editor.config.filebrowserUploadMethod !== 'xhr' || !isFileUploadApiSupported ) {
if ( editor.config.filebrowserUploadMethod === 'form' || !isFileUploadApiSupported ) {
// Append token preventing CSRF attacks.
appendToken( fileInput );
return true;
Expand Down Expand Up @@ -604,19 +604,18 @@
*
* Available values:
*
* * `'xhr'` - XMLHttpRequest is used to upload file. Using this option allows to set up with Additional XHR headers with
* * `'xhr'` - (default) XMLHttpRequest is used to upload file. Using this option allows to set up with additional XHR headers with
* {@link CKEDITOR.config#fileTools_requestHeaders} option.
* * `'form'` - (default) File is uploaded by submitting a traditional `<form>` element.
* * `'form'` - File is uploaded by submitting a traditional `<form>` element.
* * `null` - The default method is used.
*
* Note: please be aware that `'xhr'` requires the [File Tools](https://ckeditor.com/cke4/addon/filetools) plugin to work
* properly. Without the plugin or using a browser that does not support
* {@link CKEDITOR.fileTools#isFileUploadSupported file uploading}, will fallback to the `'form'` method despite configuration
* option.
*
* // Modern browsers will use XMLHttpRequest to upload files.
* // IE8 and IE9 will use form submit even though the config option is set to 'xhr'.
* config.filebrowserUploadMethod = 'xhr';
* // All browsers will use form element with submit method to upload a file.
* config.filebrowserUploadMethod = 'form';
*
* @since 4.9.0
* @cfg {String/null} [filebrowserUploadMethod=null]
Expand Down

0 comments on commit 4e0866c

Please sign in to comment.