# file-manager-pass-custom-value-to-server

> File manager that sends a custom value to the server with file, download and image requests.

**Framework:** react  **Component:** FileManager  **Variant:** pass-custom-value-to-server

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/react/js/file-manager-pass-custom-value-to-server.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-filemanager
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/file-manager-pass-custom-value-to-server/FileManager.jsx

```jsx
import { FileManagerComponent, Inject, NavigationPane, DetailsView, Toolbar } from '@syncfusion/ej2-react-filemanager';
/**
 * File Manager sample that passes a custom value to the server
 */
const PassCustomValueToServer = () => {
    let hostUrl = "https://physical-service.syncfusion.com/";
    function onBeforeSend(args) {
        if (args.ajaxSettings) {
            args.ajaxSettings.beforeSend = function (args) {
                args.httpRequest.setRequestHeader('Authorization', 'User1');
            };
        }
    }
    function onBeforeDownload(args) {
        args.useFormPost = false;
        if (args.ajaxSettings) {
            args.ajaxSettings.beforeSend = function (args) {
                args.fetchRequest.headers.append('Authorization', 'User1');
            };
        }
    }
    function onBeforeImageLoad(args) {
        args.useImageAsUrl = false;
        // Check if ajaxSettings are present in the arguments
        if (args.ajaxSettings) {
            (args.ajaxSettings).beforeSend = function (args) {
                // Append Authorization header with value 'User1' to fetchRequest headers
                args.fetchRequest.headers.append('Authorization', 'User1');
            };
        }
    }
    return (<div>
            <div className="control-section">
                <FileManagerComponent id="file" ajaxSettings={{
            url: hostUrl + "api/FileManager/FileOperations",
            downloadUrl: hostUrl + "api/FileManager/Download",
            uploadUrl: hostUrl + "api/FileManager/Upload",
            getImageUrl: hostUrl + "api/FileManager/GetImage"
        }} beforeSend={onBeforeSend.bind(this)} beforeDownload={onBeforeDownload.bind(this)} beforeImageLoad={onBeforeImageLoad.bind(this)}>
                    <Inject services={[NavigationPane, DetailsView, Toolbar]}/>
                </FileManagerComponent>
            </div>
        </div>);
};
export default PassCustomValueToServer;

```
