{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "file-manager-directory-upload",
  "framework": "react",
  "type": "registry:component",
  "component": "FileManager",
  "variant": "directory-upload",
  "dependencies": [
    "@syncfusion/ej2-react-filemanager",
    "@syncfusion/ej2-react-splitbuttons"
  ],
  "description": "File manager with a toolbar dropdown to upload either individual files or a whole folder.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": true,
    "platformIndex": "https://ai.syncfusion.com/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/js/file-manager-directory-upload.md"
  },
  "files": [
    {
      "target": "src/components/file-manager-directory-upload/FileManager.jsx",
      "content": "import { useRef, useState } from 'react';\nimport { FileManagerComponent, Inject, NavigationPane, DetailsView, Toolbar, ToolbarItemsDirective, ToolbarItemDirective } from '@syncfusion/ej2-react-filemanager';\nimport { DropDownButtonComponent } from '@syncfusion/ej2-react-splitbuttons';\n/**\n * File Manager folder upload sample\n */\nconst DirectoryUpload = () => {\n    const [isDirectoryUpload, setIsDirectoryUpload] = useState(false);\n    let fmObj = useRef(null);\n    const dropBtnRef = useRef(null);\n    let hostUrl = \"https://physical-service.syncfusion.com/\";\n    const OnCreated = () => {\n        if (fmObj.current && dropBtnRef.current) {\n            const fm = fmObj.current;\n            const uploadText = fm.localeObj.getConstant('Upload');\n            dropBtnRef.current.content = `<span class=\"e-tbar-btn-text\">${uploadText}</span>`;\n            dropBtnRef.current.items = [\n                { text: fm?.localeObj?.getConstant('Folder') || 'Folder' },\n                { text: fm?.localeObj?.getConstant('File') || 'File' },\n            ];\n        }\n    };\n    const onSelect = (args) => {\n        if (args.item.text === fmObj.current?.localeObj.getConstant('Folder')) {\n            setIsDirectoryUpload(true);\n        }\n        else {\n            setIsDirectoryUpload(false);\n        }\n        setTimeout(() => {\n            let uploadBtn = document.querySelector('.e-file-select-wrap button');\n            uploadBtn.click();\n        }, 100);\n    };\n    const uploadClick = (e) => {\n        e.stopPropagation();\n    };\n    const uploadTemplate = () => {\n        return (<DropDownButtonComponent ref={dropBtnRef} id=\"dropButton\" cssClass=\"e-tbar-btn e-tbtn-txt\" onClick={uploadClick} iconCss='e-icons e-fe-upload' select={onSelect} created={OnCreated}>\n            </DropDownButtonComponent>);\n    };\n    return (<div>\n            <div className=\"control-section\">\n                <FileManagerComponent id=\"file\" ref={fmObj} uploadSettings={{ directoryUpload: isDirectoryUpload }} ajaxSettings={{ url: hostUrl + \"api/FileManager/FileOperations\", getImageUrl: hostUrl + \"api/FileManager/GetImage\", uploadUrl: hostUrl + 'api/FileManager/Upload', downloadUrl: hostUrl + 'api/FileManager/Download' }} contextMenuSettings={{\n            file: ['Cut', 'Copy', '|', 'Delete', 'Download', 'Rename', '|', 'Details'],\n            visible: true\n        }}>\n                    <ToolbarItemsDirective>\n                            <ToolbarItemDirective name='NewFolder'/>\n                            <ToolbarItemDirective template={uploadTemplate} name=\"Upload\"/>\n                            <ToolbarItemDirective name=\"SortBy\"/>\n                            <ToolbarItemDirective name=\"Refresh\"/>\n                            <ToolbarItemDirective name=\"Cut\"/>\n                            <ToolbarItemDirective name=\"Copy\"/>\n                            <ToolbarItemDirective name=\"Paste\"/>\n                            <ToolbarItemDirective name=\"Delete\"/>\n                            <ToolbarItemDirective name=\"Download\"/>\n                            <ToolbarItemDirective name=\"Rename\"/>\n                            <ToolbarItemDirective name=\"Selection\"/>\n                            <ToolbarItemDirective name=\"View\"/>\n                            <ToolbarItemDirective name=\"Details\"/>\n                        </ToolbarItemsDirective>\n                    <Inject services={[NavigationPane, DetailsView, Toolbar]}/>\n                </FileManagerComponent>\n            </div>\n        </div>);\n};\nexport default DirectoryUpload;\n"
    }
  ]
}