# file-manager-pass-custom-value-to-server

> File manager that sends a custom value to the server with file, download and image requests.

**Framework:** angular  **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/angular/file-manager-pass-custom-value-to-server.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-angular-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/file-manager.component.html

```html
<div class="sample-container">
    <ejs-filemanager id="filemanager" [ajaxSettings]="ajaxSettings" (beforeSend)="onBeforeSend($event)"
        (beforeDownload)="onBeforeDownload($event)" (beforeImageLoad)="onBeforeImageLoad($event)">
    </ejs-filemanager>
</div>

```

### src/components/file-manager-pass-custom-value-to-server/file-manager.component.ts

```typescript
import { Component, ViewEncapsulation } from '@angular/core';
import { FileManagerModule, NavigationPaneService, ToolbarService, DetailsViewService, BeforeSendEventArgs, BeforeDownloadEventArgs, BeforeImageLoadEventArgs } from '@syncfusion/ej2-angular-filemanager';
/**
 * File Manager sample that passes a custom value to the server
 */
@Component({
    selector: 'control-content',
    templateUrl: 'file-manager.component.html',
    styleUrls: ['../file-manager-common.style.css'],
    encapsulation: ViewEncapsulation.None,
    providers: [NavigationPaneService, ToolbarService, DetailsViewService],
    standalone: true,
    imports: [FileManagerModule]
})

export class PassCustomValueToServerController {
    public hostUrl: string = 'https://physical-service.syncfusion.com/';
    public ajaxSettings: object = {
        url: this.hostUrl + 'api/FileManager/FileOperations',
        getImageUrl: this.hostUrl + 'api/FileManager/GetImage',
        uploadUrl: this.hostUrl + 'api/FileManager/Upload',
        downloadUrl: this.hostUrl + 'api/FileManager/Download',
    };

    onBeforeSend(args: BeforeSendEventArgs): void {
        if (args.ajaxSettings) {
            (args.ajaxSettings as any).beforeSend = function (args: any) {
                args.httpRequest.setRequestHeader('Authorization', 'User1');
            };
        }
    }

    onBeforeDownload(args: BeforeDownloadEventArgs): void {
        args.useFormPost = false;
        if (args.ajaxSettings) {
            (args.ajaxSettings as any).beforeSend = function (args: any) {
                args.fetchRequest.headers.append('Authorization', 'User1');
            };
        }
    }

    onBeforeImageLoad(args: BeforeImageLoadEventArgs): void {
        // Add custom parameter in image URL
        args.useImageAsUrl = false;
        // Check if ajaxSettings are present in the arguments
        if (args.ajaxSettings) {
            (args.ajaxSettings as any).beforeSend = function (args: any) {
                // Append Authorization header with value 'User1' to fetchRequest headers
                args.fetchRequest.headers.append('Authorization', 'User1');
            };
        }
    }
}

```
