Sry for asking so much [ 3rd in 2 days ] this time I want to make it so when ftp_put uploads a file it wont show the result each time it uploads , like "Success Success" but I want it to say only when it finishes to upload all the files. My current code:
foreach (glob("black/*") as $filename)
if(ftp_put($conn, $ftpFolder . basename($filename) , $filename, FTP_BINARY)) {
echo "sall goodman"; }
else { echo "not goot bruh"; }
}
[ dont look at the answers right now, its just for duh lulz and testing ]
Thanks in advance guys, You are really helping me out :)
Just comment the statement , echo "sall goodman"
and you are good to go such that you won't get the repeated success message.
I have extended your example a bit, If all files are uploaded successfully you get the message All files have been successfully uploaded
, else say if some 2 files failed on upload then you will get 2 file(s) have been failed during upload
.
$totFiles = 0;
$successUploadFiles=0;
foreach (glob("black/*") as $filename)
if(ftp_put($conn, $ftpFolder . basename($filename) , $filename, FTP_BINARY)) {
//echo "sall goodman";
$successUploadFiles++;
}
else { echo "not goot bruh"; }
$totFiles++;
}
if($totFiles == $successUploadFiles)
{
echo "All files have been successfully uploaded";
}
else
{
echo $totFiles-$successUploadFiles." file(s) have been failed during upload";
}