A production-ready, single-file PHP application for secure, high-performance FTP file transfers with real-time progress tracking and a modern web interface.
Transfer files directly from one cPanel to another using FTP - no need to zip, download, upload, and extract!
- ποΈ SQLite Storage - All data stored in embedded SQLite database (no external JSON files)
- π Simplified Login - Only 3 fields: FTP Host, Username, Password
- π Working File Browser - Fixed file listing after login
- π― Clear Transfer Button - Shows count of selected files
- π Real-time Search - Filter files as you type
- π Better Logs - View transfer logs directly in the UI
- β Better Errors - Specific, actionable error messages
- SQLite Database - All data stored in
cpanel_data.db(single file) - No External Files - No more
users.json,encryption.key,transfers.log - Automatic Setup - Database created automatically on first run
- HTTPS Enforcement - Strict HTTPS requirement for all connections
- Session-based Authentication - Secure session management with 30-minute timeout
- CSRF Protection - Token-based CSRF prevention
- Path Traversal Prevention - Comprehensive path sanitization and validation
- Encrypted Credentials - AES-256-CBC encryption for stored credentials
- Input Validation - Strict validation for all user inputs
- Non-blocking Transfers - Uses
ftp_nb_fget()for asynchronous operations - Parallel Processing - Up to 3 concurrent transfers (when
pcntlavailable) - Chunked Streaming - 2MB chunks to minimize memory usage
- Persistent Connections - Reuse FTP connections for multiple operations
- Memory Efficient - Operates under 128MB memory limit
- Real-time Updates - Live progress bars with 2-second polling
- Speed Calculation - Accurate transfer speed in MB/s
- ETA Display - Intelligent time-remaining estimates
- Overall Statistics - Track total, completed, in-progress, and pending files
- Per-file Status - Individual progress for each transfer
- JSON Format - Structured logs with timestamps (ISO 8601)
- Comprehensive Data - Tracks paths, sizes, duration, checksums, errors
- Automatic Rotation - Rotates logs when exceeding 10MB
- Web Viewer - View recent logs directly in the UI
- Responsive Design - Mobile-first, works on all devices
- Tree View Browser - Expandable folder structure
- Cascade Selection - Select folders to auto-select all children
- Search Functionality - Filter files in real-time
- Toast Notifications - Non-intrusive status messages
- Smooth Animations - Professional transitions and effects
- PHP 7.4+ (PHP 8.0+ recommended)
- FTP Extension -
ext-ftpenabled - OpenSSL Extension - For encryption
- Optional:
pcntlextension for parallel transfers
-
Download the file:
git clone https://github.com/yourusername/cpanel_web_transfer.git cd cpanel_web_transfer -
Upload to your web server (via FTP, SCP, or control panel)
-
Set permissions:
chmod 644 cpanel.php
-
Access via browser:
https://your-domain.com/path/to/cpanel.php -
First-time setup:
- On first access, you'll see a setup form
- Create your admin username and password
- This account will be used to access the application
-
Login and transfer:
- Enter your application credentials (username/password)
- Enter FTP credentials for the source server
- Select destination path on current server
- Browse files, select what you want
- Click "Start Transfer"!
The application now uses session-based authentication with automatic setup:
- No manual configuration required - credentials are set up on first use
- Encryption key is automatically generated and stored securely
- User accounts are stored in
users.jsonwith Argon2ID password hashing
define('MAX_PARALLEL', 3); // Number of concurrent transfers
define('CHUNK_SIZE', 2097152); // Transfer chunk size (2MB default)
define('SESSION_TIMEOUT', 1800); // Session timeout in seconds (30 minutes)define('LOG_FILE', __DIR__ . '/transfers.log'); // Log file location
define('PROGRESS_FILE', __DIR__ . '/progress.json'); // Progress tracking file
define('MAX_LOG_SIZE', 10485760); // Log rotation threshold (10MB)
define('USERS_FILE', __DIR__ . '/users.json'); // User accounts storage
define('ENCRYPTION_KEY_FILE', __DIR__ . '/encryption.key'); // Encryption key storage- On first access, you'll be prompted to create an admin account
- Enter a username (at least 3 characters, letters/numbers/underscores)
- Enter a strong password (at least 8 characters)
- This account will be used to access the application
- If first time, create admin account with username and password
- FTP Host: Your FTP server address (e.g.,
ftp.example.com) - FTP Username: Your FTP account username
- FTP Password: Your FTP account password
- Remote path is always
/(FTP root) - Local path is automatically set to where
cpanel.phpis located
- Files are loaded immediately after successful FTP login
- Click folder names to navigate into directories
- Use search box to filter files in real-time
- Check boxes to select files for transfer
- Selecting a folder selects that folder (not contents automatically)
- Click "Copy X Selected File(s)" button after selecting files
- Monitor real-time progress in the Progress section
- View transfer status and completion percentage
- Check logs for completed transfers and any errors
- All transfers are logged to the SQLite database
- Click "Refresh Logs" to see the latest activity
- Logs include timestamp, action, file path, size, and status
-
Strong Passwords
- Use a strong application password (8+ characters minimum)
- Passwords are hashed using Argon2ID (industry standard)
-
HTTPS Only
- Always use HTTPS in production
- The application enforces HTTPS (except on localhost)
-
File Permissions
chmod 644 cpanel.php # Read-only for web server chmod 600 cpanel_data.db # Private database file
- Ensure you're accessing via
https://protocol - Check SSL certificate is valid
- Localhost/127.0.0.1 are exempt from this check
- Verify FTP host address is correct
- Check firewall rules allow outbound FTP (port 21)
- Ensure FTP server is accessible from web server
- Verify FTP username and password
- Check account hasn't been locked
- Ensure FTP service is running
- Free up space on the destination drive
- Check available space:
df -h - Verify write permissions on destination directory
define('MAX_PARALLEL', 5); // Increase concurrent transfers
define('CHUNK_SIZE', 4194304); // Use 4MB chunksdefine('MAX_PARALLEL', 1); // Sequential transfers only
define('CHUNK_SIZE', 1048576); // Use 1MB chunksInstall the pcntl extension for true parallel transfers:
# Ubuntu/Debian
sudo apt-get install php-pcntl
# CentOS/RHEL
sudo yum install php-pcntl
# Verify
php -m | grep pcntlThe application provides several JSON API endpoints:
Authenticate and establish FTP connection.
List directory contents.
Start file transfer.
Get transfer progress.
Retrieve transfer logs.
End session and clear credentials.
β
Single-file application (no dependencies)
β
Production-ready security
β
Real-time progress tracking
β
Parallel transfers (up to 3 concurrent)
β
Non-blocking operations
β
Atomic file writes
β
SHA256 checksums
β
Automatic log rotation
β
Responsive modern UI
β
Mobile-friendly
β
Search and filter
β
Cascade selection
β
Toast notifications
β
Comprehensive error handling
β
Retry logic with exponential backoff
β
Memory efficient (< 128MB)
β
CSRF protection
β
Encrypted session storage
β
Path traversal prevention
β
Session timeout
MIT License - Free to use and modify for personal and commercial projects.
Contributions are welcome! Please feel free to submit a Pull Request.
Made with β€οΈ for the PHP community