This project is a modern React + TypeScript application bootstrapped with Vite. It demonstrates the use of a custom file uploader component, allowing users to upload, preview, and delete files with a user-friendly interface.
- Full Project Overview:
Watch Example Project.mp4
- Drag & drop file upload and file selector support
- File type and size validation (supports
.jpg,.jpeg,.png,.txt,.pdfup to 6MB) - Duplicate file detection with overwrite confirmation
- Persistent storage using
localStorage - File deletion from preview and storage
- Responsive and accessible UI
.
βββ Example Project/ # Usage example consuming this plugin
β βββ src/
β β βββ App.tsx # Demonstrates plugin usage
β βββ ...
βββ src/ # Source code for the file-uploader-plugin
β βββ components/
β β βββ FilesSave.tsx
β β βββ PreviewFiles.tsx
β β βββ RenderPreviewContent.tsx
β βββ index.tsx # Entry point of the plugin
βββ rollup.config.mjs # Bundler config for package build
βββ package.json # Package metadata and dependencies
βββ tsconfig.json # TypeScript configuration
βββ README.md # Youβre reading this!
βββ .gitignore
The main application imports the file-uploader-plugin package and renders it in App.tsx:
import FileUpload from 'file-uploader-plugin';
const App = () => (
<FileUpload />
);
export default App;To use the local version of the file uploader plugin instead of an npm-published version:
- Uninstall the npm package from the main project:
npm uninstall file-uploader-plugin- Link the local package by installing it directly from the local folder:
npm install "../"- Now, the example project will use the local build of the package. Any changes you make to the package source code (in
File Uploader Package/src/) should be followed by running the build script in the package directory:
npm run build- After building, your changes will be reflected in the example project.
-
Edit the source files in file-uploader-package/src/
-
Build the plugin:
cd ..
npm install
npm run build- Return to Example Project, and restart the dev server if needed
This project and the file-uploader-plugin are licensed under the ISC License.
Author: Aman Sharma