# SimpleUploadConfig

interface

The configuration of the [simple upload adapter](module_upload_adapters_simpleuploadadapter-SimpleUploadAdapter.md).

```typescript
ClassicEditor
	.create( {
		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"](../features/images/image-upload/simple-upload-adapter.md) guide to learn more.

See [all editor configuration options](module_core_editor_editorconfig-EditorConfig.md).

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-upload/src/uploadconfig.ts#L34)

<a id="properties">

## Properties

<a id="member-headers">

### `headers?: Record<string, string> | ( file: File ) => Record<string, string>`

[Headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) sent with the request to the server during the upload. This is the right place to implement security mechanisms like authentication and [CSRF](https://developer.mozilla.org/en-US/docs/Glossary/CSRF) protection.

The value can be specified either as an object of key-value pairs or a callback function that returns such an object:

```typescript
ClassicEditor
	.create( {
		simpleUpload: {
			// Set headers statically:
			headers: {
				'X-CSRF-TOKEN': 'CSRF-Token',
				Authorization: 'Bearer <JSON Web Token>'
			}

			// Or dynamically, based on the file:
			headers: ( file ) => {
				return {
					'X-File-Name': file.name,
					'X-File-Size': file.size
				};
			}
		}
	} );
```

Learn more about the server application requirements in the ["Server-side configuration"](../features/images/image-upload/simple-upload-adapter.md#server-side-configuration) section of the feature guide.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-upload/src/uploadconfig.ts#L78)

<a id="member-uploadUrl">

### `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"](../features/images/image-upload/simple-upload-adapter.md#server-side-configuration) section of the feature guide.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-upload/src/uploadconfig.ts#L44)

<a id="member-withCredentials">

### `withCredentials?: boolean`

This flag enables the [`withCredentials`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/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.

```typescript
ClassicEditor
	.create( {
		simpleUpload: {
			withCredentials: true
		}
	} );
	.then( ... )
	.catch( ... );
```

Learn more about the server application requirements in the ["Server-side configuration"](../features/images/image-upload/simple-upload-adapter.md#server-side-configuration) section of the feature guide.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-upload/src/uploadconfig.ts#L103)

Defaults to `false`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
