SimpleUploadConfig (upload/adapters)
@ckeditor/ckeditor5-upload/src/adapters/simpleuploadadapter
The configuration of the simple upload adapter.
ClassicEditor
.create( editorElement, {
simpleUpload: {
// The URL the images are uploaded to.
uploadUrl: 'http://example.com',
// Headers sent along with the XMLHttpRequest to the upload server.
headers: {
...
}
}
} );
.then( ... )
.catch( ... );
See the "Simple upload adapter" guide to learn more.
Filtering
Properties
-
headers : Object.<String, String>
module:upload/adapters/simpleuploadadapter~SimpleUploadConfig#headers
An object that defines additional headers sent with the request to the server during the upload. This is the right place to implement security mechanisms like authentication and CSRF protection.
ClassicEditor .create( editorElement, { simpleUpload: { headers: { 'X-CSRF-TOKEN': 'CSRF-Token', Authorization: 'Bearer <JSON Web Token>' } } } ); .then( ... ) .catch( ... );
Learn more about the server application requirements in the "Server-side configuration" section of the feature guide.
-
uploadUrl : String
module:upload/adapters/simpleuploadadapter~SimpleUploadConfig#uploadUrl
The path (URL) to the server (application) which handles the file upload. When specified, enables the automatic upload of resources (images) inserted into the editor content.
Learn more about the server application requirements in the "Server-side configuration" section of the feature guide.
-
withCredentials : Boolean
module:upload/adapters/simpleuploadadapter~SimpleUploadConfig#withCredentials
This flag enables the
withCredentials
property of the request sent to the server during the upload. It affects cross-site requests only and, for instance, allows credentials such as cookies to be sent along with the request.ClassicEditor .create( editorElement, { simpleUpload: { withCredentials: true } } ); .then( ... ) .catch( ... );
Learn more about the server application requirements in the "Server-side configuration" section of the feature guide.
Defaults to
false
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.