# file-manager-file-upload

> File manager launched from an uploader dialog to pick files for a form submit.

**Framework:** vue  **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/vue/file-manager-file-upload.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-vue-buttons @syncfusion/ej2-vue-filemanager @syncfusion/ej2-vue-inputs @syncfusion/ej2-vue-popups
```

**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/FileManager.vue

```vue
<template>
  <div class="control-section file-upload">
    <div id="uploadFileManager" class="fileupload">
      <ejs-uploader ref="uploadObj" id="defaultfileupload" name="UploadFiles" />
      <ejs-button id="openBtn" @click="btnClick">File Browser</ejs-button>
    </div>
    <div id="target" class="control-section">
      <ejs-dialog
        ref="uploadDialog"
        id="dialog"
        :visible="false"
        :header="dialogHeader"
        :animationSettings="animationSettings"
        :showCloseIcon="showCloseIcon"
        @open="dialogOpen"
        @close="dialogClose"
        :target="target"
        :width="dialogWidth"
      >
        <div>
          <ejs-filemanager
            id="filemanager"
            :ajaxSettings="ajaxSettings"
            :contextMenuSettings="contextMenuSettings"
            :toolbarSettings="toolbarSettings"
            :allowMultiSelection="false"
            @fileOpen="onFileOpen"
          />
        </div>
      </ejs-dialog>
    </div>
  </div>
</template>

<script lang="ts">
import { UploaderComponent } from '@syncfusion/ej2-vue-inputs';
import { ButtonComponent } from '@syncfusion/ej2-vue-buttons';
import { DialogComponent } from '@syncfusion/ej2-vue-popups';
import { FileManagerComponent, NavigationPane, Toolbar, DetailsView } from '@syncfusion/ej2-vue-filemanager';

const hostUrl = 'https://physical-service.syncfusion.com/';

export default {
  components: {
    'ejs-filemanager': FileManagerComponent,
    'ejs-uploader': UploaderComponent,
    'ejs-button': ButtonComponent,
    'ejs-dialog': DialogComponent
  },
  data() {
    return {
      dialogHeader: 'Select a file',
      showCloseIcon: true,
      target: '#target',
      animationSettings: { effect: 'None' },
      dialogWidth: '850px',
      ajaxSettings: {
        url: hostUrl + 'api/FileManager/FileOperations',
        getImageUrl: hostUrl + 'api/FileManager/GetImage',
        uploadUrl: hostUrl + 'api/FileManager/Upload',
        downloadUrl: hostUrl + 'api/FileManager/Download'
      },
      toolbarSettings: {
        items: ['NewFolder', 'Upload', 'Cut', 'Copy', 'Delete', 'Rename', 'SortBy', 'Refresh', 'Selection', 'View', 'Details']
      },
      contextMenuSettings: {
        file: ['Cut', 'Copy', '|', 'Delete', 'Download', 'Rename', '|', 'Details'],
        visible: true
      }
    };
  },
  provide() {
    return {
      filemanager: [NavigationPane, DetailsView, Toolbar]
    };
  },
  methods: {
    btnClick() {
      (this.$refs.uploadDialog as any).show();
      const fileObj = (document.getElementById('filemanager') as any).ej2_instances[0];
      fileObj.path = '/';
      fileObj.selectedItems = [];
      fileObj.refresh();
    },
    dialogOpen() {
      const element = document.getElementById('uploadFileManager');
      if (element) {
        element.style.display = 'none';
      }
    },
    dialogClose() {
      const element = document.getElementById('uploadFileManager');
      if (element) {
        element.style.display = 'block';
      }
    },
    onFileOpen(args: any) {
      const file = args.fileDetails;
      if (file.isFile) {
        args.cancel = true;
        (this.$refs.uploadObj as any).ej2Instances.files = [
          { name: file.name, size: file.size, type: file.type }
        ];
        (this.$refs.uploadDialog as any).hide();
      }
    }
  }
};
</script>

<style scoped>
.file-upload .fileupload {
  max-width: 500px;
  margin: auto;
}

.file-upload #openBtn {
  position: absolute;
  top: 28px;
  left: 43%;
}

.file-upload #target {
  height: 550px;
}

.file-upload #dialog {
  top: 20px !important;
  max-height: 500px !important;
  left: 30px !important;
}

.file-upload #uploadFileManager .e-file-drop,
.file-upload #uploadFileManager .e-css.e-btn {
  display: none;
}

.tailwind #openBtn,
.tailwind-dark #openBtn {
  top: 28px;
}

.bootstrap5 #openBtn,
.bootstrap5-dark #openBtn {
  top: 26px;
}

.bootstrap #openBtn,
.bootstrap-dark #openBtn {
  top: 30px;
}

.fileupload .e-file-select-wrap {
  padding: 20px 0 20px 20px;
}
</style>

```
