What steps can be taken to ensure that folders created by a PHP script are accessible for file uploads via FTP without encountering "Permission denied" errors?

When creating folders using a PHP script for file uploads, it is important to ensure that the correct permissions are set so that they can be accessed by FTP without encountering "Permission denied" errors. To fix this issue, you can use the `mkdir()` function in PHP to create the folders and then set the correct permissions using `chmod()`.

// Create a new directory
$folderPath = 'uploads/new_folder';
mkdir($folderPath);

// Set the correct permissions for the directory
chmod($folderPath, 0777);