# file-manager-file-upload

> File manager demonstrating file upload operations with an upload-enabled toolbar.

**Framework:** aspnet-core  **Component:** FileManager  **Variant:** file-upload

## 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/aspnet-core/file-manager-file-upload.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.AspNetCore.FileManager
dotnet add package Syncfusion.AspNetCore.Buttons
dotnet add package Syncfusion.AspNetCore.Popups
dotnet add package Syncfusion.AspNetCore.Inputs
```

**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-file-upload/file-manager.cshtml

```cshtml
@page

@using Syncfusion.EJ2.FileManager
@using Syncfusion.EJ2.Inputs
@using Syncfusion.EJ2.Buttons
@using Syncfusion.EJ2.Popups

@{
    var defaultanimation = new Syncfusion.EJ2.Popups.DialogAnimationSettings { Effect = Syncfusion.EJ2.Popups.DialogEffect.None };
    string[] items = new string[] { "NewFolder", "Upload", "Cut", "Copy", "Delete", "Rename", "SortBy", "Refresh", "Selection", "View", "Details" };
    string[] file = new string[] { "Cut", "Copy", "|", "Delete", "Download", "Rename", "|", "Details" };

}
            <!-- File Manager real time use case sample -->
            <div id='container' class="fileupload">
                <ejs-uploader id="UploadFile"> </ejs-uploader>
                <ejs-button id="openBtn" content="File Browser"></ejs-button>
            </div>
            <div id='target' class="control-section">
                <ejs-dialog id="dialog" animationSettings="defaultanimation" width="850px" target="#target" visible="false" open="dialogOpen" close="dialogClose" showCloseIcon="true" header="Select a file">
                    <e-content-template>
                        <ejs-filemanager id="filemanager" FileOpen="onFileOpen" allowMultiSelection="false">
                            <e-filemanager-ajaxsettings url="https://physical-service.syncfusion.com/api/FileManager/FileOperations"
                                            downloadUrl="https://physical-service.syncfusion.com/api/FileManager/Download"
                                            uploadUrl="https://physical-service.syncfusion.com/api/FileManager/Upload"
                                            getImageUrl="https://physical-service.syncfusion.com/api/FileManager/GetImage">
                            </e-filemanager-ajaxsettings>
                            <e-filemanager-toolbarsettings items="items"> </e-filemanager-toolbarsettings>
                            <e-filemanager-contextmenusettings file="file"> </e-filemanager-contextmenusettings>
                        </ejs-filemanager>
                    </e-content-template>
                </ejs-dialog>
            </div>

    <script>
        document.getElementById("openBtn").addEventListener('click', function () {
            var dialogObj = document.getElementById("dialog").ej2_instances[0];
            dialogObj.show();
            var filemanagerObj = document.getElementById('filemanager').ej2_instances[0];
            filemanagerObj.path = "/";
            filemanagerObj.selectedItems = [];
            filemanagerObj.refresh();
        });
        // Uploader will be shown, if Dialog is closed
        function dialogClose() {
            document.getElementById("container").style.display = "block";
        }
        // Uploader will be hidden, if Dialog is opened
        function dialogOpen() {
            document.getElementById("container").style.display = "none";
        }
        // File Manager's fileOpen event function
        function onFileOpen(args) {
            var file = args.fileDetails;
            if (file.isFile) {
                args.cancel = true;
                var uploadObject = document.getElementById('UploadFile').ej2_instances[0];
                var dialogObj = document.getElementById('dialog').ej2_instances[0];
                uploadObject.files = [{name: file.name, size: file.size, type: file.type }];
                dialogObj.hide();
            }
        }

    </script>

<style>
    .fileupload {
        max-width: 500px;
        margin: auto;
    }

    #openBtn {
        position: absolute;
        top: 14px;
        left: 46%;
    }

    .tailwind #openBtn,
    .tailwind-dark #openBtn {
        top: 28px;
    }

    .bootstrap #openBtn,
    .bootstrap-dark #openBtn {
        top: 30px;
    }

    .bootstrap5 #openBtn,
    .bootstrap5-dark #openBtn {
        top: 26px;
    }

    #target {
        height: 550px;
    }

    #dialog {
        top: 20px !important;
        max-height: 500px !important;
    }
    .fileupload .e-file-drop, .fileupload .e-css.e-btn {
        display: none;
    }

    .fluent2 .fileupload .e-file-select-wrap {
        padding: 20px 0 20px 20px;
    }
</style>
```
