Is there a recommended maximum file size for FTP uploads to prevent exceeding the execution time limit in PHP?

When uploading large files via FTP in PHP, there is a risk of exceeding the execution time limit due to the time it takes to transfer the file. To prevent this, it is recommended to set a maximum file size limit for uploads. This can be done by checking the file size before initiating the FTP transfer and restricting the upload if it exceeds the specified limit.

$maxFileSize = 10 * 1024 * 1024; // 10 MB

if ($_FILES['file']['size'] > $maxFileSize) {
    echo "File size exceeds the maximum limit of 10 MB.";
} else {
    // Proceed with FTP upload
}