A minimalist file upload system built with Node.js and Express for FreeBSD systems. This application provides a simple web interface for uploading, viewing, and downloading files across your network.

- Simple web-based file upload interface
- Original filename preservation
- File listing with size and upload date
- Direct file download capability
- Network-wide accessibility
- Responsive design for all devices
Before you begin, ensure you have:
- FreeBSD system
- Git installed
- Node.js (version 21 or higher)
- npm (Node Package Manager)
First, update your FreeBSD system and install the necessary packages:
# Update package repository
pkg update
# Install Node.js and npm
pkg install node21 npm-node21
# Install Git if not already installed
pkg install git
# Clone the repository
git clone https://github.com/aniketqw/file-upload-server.git
# Navigate to the project directory
cd file-upload-server
# Initialize npm project
npm init -y
# Install required packages
npm install express multer
# Create uploads directory
mkdir uploads
# Set correct permissions
chmod 755 uploads
# Install PM2 globally
npm install -g pm2
The server runs on port 3000 by default. If you need to change this:
- Open
server.js
- Locate the line:
const port = 3000;
- Change the port number as needed
Default maximum file size is 10MB. To modify:
- Open
server.js
- Find the multer configuration section
- Adjust the
fileSize
limit:
limits: {
fileSize: 10 * 1024 * 1024 // 10MB limit
}
# Start the server using PM2
pm2 start server.js --name "file-upload-server"
# Ensure the server starts on boot
pm2 startup
pm2 save
# Check if the server is running
pm2 status
# View server logs
pm2 logs file-upload-server
Open your web browser and navigate to:
http://<FreeBSD_IP_ADDRESS>:3000
Replace <FreeBSD_IP_ADDRESS>
with your server's IP address.
- Click the "Choose File" button
- Select the file you want to upload
- Click the "Upload" button
- Wait for the upload to complete
- The page will refresh automatically
- All uploaded files are listed in the table below the upload form
- The table shows:
- File name
- File size
- Upload date
- Click "Refresh Files" to update the list
- Click the "Download" link next to any file to download it
- Files are downloaded with their original names
-
Upload Not Working
- Check server logs:
pm2 logs file-upload-server
- Verify uploads directory permissions:
ls -la uploads/
- Ensure file size is within limits
- Check server logs:
-
File List Not Loading
- Check browser console for errors (F12)
- Verify server is running:
pm2 status
- Check network connectivity
-
Permission Issues
# Reset uploads directory permissions chmod 755 uploads chown your_user:your_group uploads
-
Server Won't Start
- Check if port 3000 is already in use:
sockstat -4 | grep 3000
- Try stopping and restarting:
pm2 stop file-upload-server pm2 start file-upload-server
- Check if port 3000 is already in use:
# Update dependencies
npm update
# Check server status
pm2 status
# View logs
pm2 logs
# Restart server
pm2 restart file-upload-server
Regularly backup your uploads directory:
tar -czf backup-$(date +%Y%m%d).tar.gz uploads/
- The server accepts all file types by default
- Files are stored with original names
- No authentication system is implemented
- Consider implementing additional security measures for production use
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or need assistance, please open an issue on the GitHub repository.
For more information or updates, visit the GitHub repository.