π A complete desktop application for uploading and managing images
π Built with Electron (frontend) + Express.js (backend)
π Secure file handling with Multer and CORS
βοΈ Image Upload - Drag & drop or file selection
βοΈ Live Preview - See images before uploading
βοΈ Gallery View - Display all uploaded images
βοΈ Cross-Platform - Works on Windows, macOS, and Linux
βοΈ Auto-Save - Files stored in ~/electron-uploads
git clone https://github.com/TheekshanaCN/electron-image-uploader.git
cd electron-image-uploadernpm installnpm startFor development, use npm run dev with nodemon for live reloading
npm run buildGenerates executables for Windows, macOS, and Linux
electron-image-uploader/
βββ src/
β βββ main.js # Electron main process
β βββ api.js # Express backend
β βββ preload.js # Secure IPC bridge
β βββ renderer/
β βββ index.html # Frontend UI
β βββ renderer.js # Frontend logic
βββ package.json
βββ README.md
Modify UPLOADS_DIR in api.js:
const UPLOADS_DIR = path.join(os.homedir(), 'your-custom-folder');Edit the fileFilter in api.js to restrict file types:
fileFilter: (req, file, cb) => {
if (file.mimetype.startsWith('image/')) cb(null, true);
else cb(new Error('Only images (JPEG, PNG, GIF) allowed!'), false);
}- Uses HTML/CSS/JS for UI
- Communicates with Express via IPC
- Displays previews and gallery
- Handles file uploads with Multer
- Serves images via API (
/api/upload,/api/images/:filename) - Stores files in
~/electron-uploads
- CORS enabled for safe API requests
- File validation (only images allowed)
- Context Isolation (Electron security best practice)
Build platform-specific executables:
npm run build:win # Windows (NSIS)
npm run build:mac # macOS (DMG)
npm run build:linux # Linux (AppImage)(Requires electron-builder β already included in package.json)
β "API not ready" error
Ensure Express starts before the Electron window (check main.js)
β Upload fails silently
Check DevTools (
Ctrl+Shift+I) for errors
VerifyUPLOADS_DIRexists and is writable
β Build errors
Make sure
icon.icoexists insrc/assets/
MIT Β© TheekshanaCN
Happy Coding! π¨π
