What are some considerations for handling temporary file paths in PHP when uploading files to an FTP server?

When uploading files to an FTP server in PHP, it is important to handle temporary file paths properly to ensure the security and integrity of the uploaded files. One consideration is to use the `move_uploaded_file()` function to move the temporary file to a secure location before transferring it to the FTP server. Additionally, make sure to sanitize the file path to prevent any directory traversal attacks.

// Get the temporary file path
$tempFilePath = $_FILES['file']['tmp_name'];

// Move the temporary file to a secure location
$destinationPath = '/path/to/secure/location/' . $_FILES['file']['name'];
move_uploaded_file($tempFilePath, $destinationPath);

// Connect to FTP server and upload the file
$ftpServer = 'ftp.example.com';
$ftpUsername = 'username';
$ftpPassword = 'password';
$ftpConnection = ftp_connect($ftpServer);
ftp_login($ftpConnection, $ftpUsername, $ftpPassword);
ftp_put($ftpConnection, '/remote/path/' . $_FILES['file']['name'], $destinationPath, FTP_BINARY);

// Close FTP connection and delete the temporary file
ftp_close($ftpConnection);
unlink($destinationPath);