I\'m curious how to upload file through FTP using PHP. Let\'s say I have upload form and user have uploaded a file. How to transfer the file (without moving from temp direct
For anyone want to show a the upload progress while doing file transfers, this is a great library php-ftp-client to start :
The code
$interval = 1;
$ftp->asyncDownload('illustrations/assets.zip', 'assets.zip', function ($stat) use ($interval) {
ob_end_clean();
ob_start();
echo sprintf(
"speed : %s KB/%ss | percentage : %s%% | transferred : %s KB | second now : %s
",
$stat['speed'],
$interval,
$stat['percentage'],
$stat['transferred'],
$stat['seconds']
);
ob_flush();
flush();
}, true, $interval);
Result in the browser :