New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-folder-dropzone

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-folder-dropzone

A React component for uploading images and folders with drag-and-drop support

latest
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

📁 React Folder Image Uploader

A flexible React component to upload images and folders with support for drag & drop, file previews, and folder hierarchy.

✅ Upload entire folders
✅ Preserves relative paths
✅ Drag & Drop support
✅ No dependencies beyond React

🚀 Installation

npm install react-folder-dropzone

Or using yarn:

yarn add react-folder-dropzone

🧪 Quick Start

import React, { useState } from 'react';
import Uploader from 'react-folder-dropzone';

const App = () => {
  const [files, setFiles] = useState([]);

  const handleUploadComplete = (uploadedFiles) => {
    setFiles(uploadedFiles);
    console.log('Files received:', uploadedFiles);
  };

  return (
    <div className="max-w-xl mx-auto p-6">
      <Uploader onUploadComplete={handleUploadComplete} />
    </div>
  );
};

export default App;

🔧 Props Reference

Prop NameTypeDefault ValueDescription
onUploadCompleteFunctionundefinedCallback triggered with all processed files
fileTypesString'image/*'Accept only specific MIME types
showButtonsBooleantrueToggle visibility of file/folder buttons
dragLabelString'Drag & drop your images or folders here'Label inside the drag-and-drop box
buttonLabelsObject{ file: 'Upload Files', folder: 'Upload Folder' }Custom text for upload buttons
containerClassString''Custom container CSS/Tailwind class
dragClassString''Custom class for drag-and-drop box

📤 Output Format

The onUploadComplete callback receives an array of file objects:

[
  {
    name: 'image.jpg',
    type: 'image/jpeg',
    relativePath: 'photos/image.jpg',
    url: 'blob:http://localhost/abc-xyz'
  },
  ...
]
  • relativePath: Full path including folder names
  • url: A blob URL to preview or use in the browser

🧱 Folder Drag-and-Drop Support

✅ Folder uploads supported using:

  • webkitdirectory input
  • Drag-and-drop entries using webkitGetAsEntry

⚠️ Firefox does not support folder drag uploads due to browser limitations.

🎨 Styling Example

<Uploader
  dragClass="bg-green-50 border-green-400"
  containerClass="bg-white p-6 shadow-md rounded"
/>

Use Tailwind or your own class names.

📦 Package Structure

react-folder-image-uploader/
├── dist/              # Compiled library files
├── src/
│   └── Uploader.js    # Main component
├── package.json
├── vite.config.js
└── README.md

🛠 Build for Publishing

Install dev dependencies:

npm install

Then run:

npm run build

Bundled output will be saved to the dist/ folder.

📜 License

MIT License © Faizul Hassan Rhine

🙋‍♀️ Author

Made with ❤️ by Faizul Hassan Rhine

GitHub: [https://github.com/FaizulHassan-Rhine]

📬 Contributions

Feel free to open issues or submit pull requests! Let’s improve it together 💪

Keywords

react

FAQs

Package last updated on 22 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts