Interface

SimpleUploadConfig (upload/adapters)

@ckeditor/ckeditor5-upload/src/adapters/simpleuploadadapter

interface

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.

See all editor configuration options.

Filtering

Properties

  • headers : Object.<String, String>

    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

    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 | undefined

    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