A beautiful and modern Flutter application that runs an HTTP server with file hosting, drag-and-drop upload, and IP whitelisting capabilities.
✨ HTTP Server Management
- Start/Stop server from the app UI
- Configurable port number
- Real-time server status display
- Automatic WiFi IP detection
- Prevents phone from sleeping while server is running
📁 File Hosting
- List all shared files with direct download links
- Beautiful web interface with modern gradient design
- File size display
- Easy file management
- Streaming downloads for large files - efficient memory usage
- HTTP Range request support - enables multi-threaded/resumable downloads
📤 File Upload & Import
- Import files from device - Pick files directly from your phone's storage via the app UI
- Drag-and-drop file upload interface (web)
- Click to browse and upload (web)
- Real-time upload progress bar with percentage
- Live upload speed indicator (KB/s, MB/s)
- Shows uploaded size / total size (e.g., "15.3 MB / 50 MB")
- Cancel upload button during transfer
- JSON API responses
- Multiple file support (both app and web)
- Supports all file types (binary and text files)
- Sequential upload with visual feedback
- Streaming upload for large files - no memory bloat, handles multi-GB files efficiently
- Atomic file uploads - files written to temp directory first, moved to final location only after successful upload
- Automatic filename conflict resolution - duplicates get timestamped names
🔒 IP Whitelisting
- Whitelist specific IP addresses for access control
- Add/remove IPs from the UI
- Empty whitelist allows all connections
- Localhost always allowed
🎨 Modern UI
- Material Design 3
- Responsive layout
- Beautiful cards and animations
- Easy-to-use controls
- Copy file path to clipboard with one tap
- Copy server URL to clipboard
- Copy direct file URLs for sharing
- Delete files with confirmation dialog (app UI only)
- Auto-refresh: App UI updates every 3 seconds, web page updates after upload
- Flutter SDK (3.9.2 or higher)
- Dart SDK
- Android Studio / Xcode (for mobile deployment)
- Clone or download this repository
- Navigate to the project directory
- Install dependencies:
flutter pub getflutter runOr use your IDE's run button.
- Open the app
- (Optional) Configure the port number (default: 8080)
- Tap the "Start Server" button
- The server URL will be displayed (e.g.,
http://192.168.1.100:8080) - Your phone will stay awake automatically while the server is running
- Open a web browser on any device on the same network
- Navigate to the server URL displayed in the app
- You'll see a beautiful page with:
- File upload section (drag & drop or click)
- List of available files with download links
Via App (Import from Device):
- In the "Shared Files" section, tap the "Import Files from Device" button
- Select one or multiple files from your device storage
- The app will copy them to the shared directory
- Files are immediately available for sharing via the web interface
- If a file with the same name exists, a timestamp is added automatically
Via Web Interface:
- Drag files onto the drop zone
- Or click the drop zone to browse files
- Watch real-time upload progress:
- Percentage (e.g., "85%")
- Speed (e.g., "2.45 MB/s")
- Size uploaded / total (e.g., "42.5 MB / 50 MB")
- Files are automatically uploaded and the list refreshes dynamically
- Click any file name in the web interface
- File will download directly
- Multi-threaded downloads supported: Use download managers like IDM, aria2, or wget with
-cflag for faster, resumable downloads - Resume downloads: Interrupted downloads can be resumed from where they left off
- In the app, scroll to the "IP Whitelist" section
- Enter an IP address (e.g.,
192.168.1.50) - Tap the + button to add
- Only whitelisted IPs can access the server
- Leave empty to allow all connections
Copy File URL:
- Click the link icon (🔗) next to any file to copy its direct download URL
- Share this URL with others to let them download the file directly
Delete Files (App UI Only):
- Click the delete icon (🗑️) next to any file in the app
- Confirm the deletion in the dialog
- File is removed immediately
- Both app UI and web page auto-refresh to show changes
Cancel Upload:
- During file upload on web page, click the "✖ Cancel Upload" button
- Upload will be stopped immediately
- Tap the "Stop Server" button when done
Files are stored in the app's private data directory:
- Android:
/storage/emulated/0/Android/data/com.example.flutter_host_server/files/shared_files/ - iOS: App's document directory
- Desktop:
Documents/FlutterFileServer/
The exact path is displayed in the "Shared Files" section of the app.
Android Note: This is the app's private data directory, which means:
- Files are fully accessible by the app
- Files are deleted when you uninstall the app
- Files can be accessed via USB debugging (adb) or with root access
- Use the "Import Files from Device" button in the app to add files from your device storage
- No issues with scoped storage restrictions
The app requires the following permissions:
INTERNET- To run the HTTP serverACCESS_NETWORK_STATE- To detect network statusACCESS_WIFI_STATE- To get WiFi informationACCESS_FINE_LOCATION- To get WiFi IP address (for getting WiFi network info)ACCESS_COARSE_LOCATION- For network infoREAD_EXTERNAL_STORAGE(Android 12 and below) - To pick files from device storageREAD_MEDIA_IMAGES,READ_MEDIA_VIDEO,READ_MEDIA_AUDIO(Android 13+) - To pick files from device storage
Note: Storage permissions are only requested when you use the "Import Files from Device" feature. The app will prompt you for permission the first time you use it.
The app requires:
- Local Network Usage - To run the HTTP server
- Location When In Use - To get WiFi network information
- Framework: Flutter
- HTTP Server: Shelf package
- File Storage: path_provider package
- Network Info: network_info_plus package
- UI: Material Design 3
-
Network Security: This server runs on your local network. Anyone with access to your network can potentially connect (unless you use IP whitelisting).
-
IP Whitelisting: For better security, always use IP whitelisting to restrict access to trusted devices.
-
HTTPS: This server uses HTTP (not HTTPS), so data is not encrypted in transit. Don't use it for sensitive files on untrusted networks.
-
Firewall: Some networks may block incoming connections. Check your firewall settings if you can't connect.
-
Production Use: This is designed for local/development use. For production, consider using proper authentication and HTTPS.
-
File Handling: Filenames are properly URL encoded/decoded and HTML escaped to prevent injection attacks and handle special characters correctly.
- Ensure both devices are on the same WiFi network
- Check your firewall settings
- Try disabling any VPN
- Verify the IP address and port are correct
- Check if the port is already in use
- Try a different port number (e.g., 8081, 8082)
- Ensure you have network permissions
- Tap the refresh button in the "Shared Files" section
- Check the file storage location (shown in the app)
- Restart the server
- To add files manually: Use the "Import Files from Device" button in the app instead of manually copying files to the directory
- The app will request storage permissions when you first use the import feature
- If you denied permissions, go to Settings → Apps → Flutter Host Server → Permissions and enable storage access
- Or tap "Open Settings" when the permission dialog appears
- Check file size (very large files may take time)
- Ensure you have storage space
- Try refreshing the web page
- The wakelock is only active when the server is running
- Make sure you've started the server
- Some devices have aggressive power management that may override wakelock
- Check your device's battery optimization settings
lib/
├── main.dart # App entry point
├── screens/
│ └── server_home_page.dart # Main UI screen
├── services/
│ └── http_server_service.dart # HTTP server logic
└── utils/
├── html_generator.dart # Web page generation
└── multipart_parser.dart # File upload parsing
android/ # Android-specific configuration
ios/ # iOS-specific configuration
windows/ # Windows-specific configuration
linux/ # Linux-specific configuration
macos/ # macOS-specific configuration
POST /upload
Uploads a file to the server with multipart/form-data.
Response:
{
"success": true,
"message": "File uploaded successfully",
"filename": "example.jpg",
"size": 12345
}Error Response:
{
"success": false,
"message": "Error description"
}GET /files/{filename}
Downloads a file from the server. The filename is URL-encoded.
Headers:
Accept-Ranges: bytes- Always present to indicate range request supportContent-Range: bytes <start>-<end>/<total>- Present in 206 responsesContent-Length: <size>- Size of the response (full file or partial)Content-Disposition: attachment; filename="<name>"- Download filenameContent-Type: application/octet-stream- Binary file type
Range Requests: The server supports HTTP Range requests for multi-threaded and resumable downloads.
Request Header:
Range: bytes=<start>-<end>- Request a specific byte range
Examples:
Range: bytes=0-499- First 500 bytesRange: bytes=500-999- Bytes 500-999Range: bytes=500-- From byte 500 to endRange: bytes=-500- Last 500 bytes
Response Codes:
200 OK- Full file (no range requested)206 Partial Content- Partial file (range requested)416 Range Not Satisfiable- Invalid range
Response: Binary file data with Content-Disposition header.
GET /api/files
Gets the current list of files on the server (used for dynamic refresh).
Response:
{
"success": true,
"files": [
{
"filename": "example.jpg",
"size": 12345
},
{
"filename": "document.pdf",
"size": 98765
}
]
}Note: File deletion is only available from the app UI for security reasons.
The app follows a clean, modular architecture:
main.dart: Minimal entry point, just initializes the appscreens/: UI layer with all Flutter widgetsserver_home_page.dart: Main screen with server controls and file management
services/: Business logic layerhttp_server_service.dart: Handles HTTP server lifecycle, request routing, and IP whitelisting
utils/: Utility classeshtml_generator.dart: Generates the web interface HTML with CSS and JavaScriptmultipart_parser.dart: Parses multipart/form-data for binary file uploads
This separation makes the code maintainable, testable, and easy to extend.
shelf: ^1.4.1- HTTP server frameworkshelf_static: ^1.1.2- Static file servingpath_provider: ^2.1.1- File system paths (includes getExternalStorageDirectory)path: ^1.9.0- Path manipulationnetwork_info_plus: ^5.0.2- Network informationwakelock_plus: ^1.2.5- Prevents phone from sleeping while server runs
Feel free to submit issues and enhancement requests!
This project is open source and available under the MIT License.
- Server status with URL display
- Start/Stop controls
- IP whitelist management
- Shared files list
- Modern gradient design
- Drag-and-drop upload
- File listing with sizes
- Responsive layout
Potential features for future versions:
- HTTPS support
- User authentication
- File deletion from web interface
- Upload progress indicator
- QR code for easy URL sharing
- File preview
- Folder support
- Search functionality
For issues and questions, please open an issue on the repository.
Made with ❤️ using Flutter