A simple, web-based file manager application built with Go that allows you to manage files and folders through a web interface.
- 📁 Browse directories - Navigate through folders with breadcrumb navigation
- 📤 Upload files - Upload files to any directory
- 📥 Download files - Download files directly from the web interface
- 📁 Create folders - Create new directories
- 🗑️ Delete files/folders - Remove files and directories
- 🔒 Security - Path traversal protection to keep files within the designated directory
- 📱 Responsive design - Works on desktop and mobile devices
-
Prerequisites: Make sure you have Go installed (Go 1.21 or later)
-
Clone or download the project files
-
Run the application:
go run main.go
-
Access the file manager: Open your web browser and go to
http://localhost:8080
filemanager/
├── main.go # Main application file
├── go.mod # Go module file
├── README.md # This file
└── files/ # Root directory for file management (created automatically)
- Click on folder names to enter directories
- Use the "⬆️ Up" button to go to the parent directory
- Use breadcrumb navigation to jump to any parent directory
- Upload File: Click "📤 Upload File" button, select a file, and click "Upload"
- Download File: Click the "📥 Download" button next to any file
- Delete: Click the "🗑️ Delete" button next to any file or folder (confirmation required)
- Create Folder: Click "📁 New Folder" button, enter a name, and click "Create"
- Navigate: Click on any folder name to enter it
By default, files are managed in the ./files directory. To change this, modify the rootDir variable in main.go:
rootDir = "/path/to/your/directory"To run on a different port, modify the port in the ListenAndServe call:
log.Fatal(http.ListenAndServe(":3000", nil)) // Changes port to 3000- Path Traversal Protection: Prevents access to files outside the designated root directory
- Safe File Operations: All file operations are validated to ensure they stay within bounds
- Input Validation: Form inputs are validated before processing
GET /- Main file browser interfacePOST /upload- Upload filesGET /download- Download filesPOST /mkdir- Create directoriesPOST /delete- Delete files/directories
This application works with all modern web browsers including:
- Chrome/Chromium
- Firefox
- Safari
- Edge
The application is built with:
- Backend: Go (standard library only)
- Frontend: HTML5, CSS3, JavaScript (vanilla)
- Styling: Custom CSS with responsive design
- Permission Denied: Make sure the application has read/write permissions to the files directory
- Port Already in Use: Change the port number in
main.goif port 8080 is already occupied - File Upload Issues: Check that the files directory exists and is writable
- "Access denied" - Attempting to access files outside the root directory
- "Failed to read directory" - Directory doesn't exist or no read permissions
- "Failed to create file" - No write permissions or disk space issues
This project is open source and available under the MIT License.