diff --git a/rule/ftpsyncfiles/rule_class.php b/rule/ftpsyncfiles/rule_class.php index 8eb073a6..4b0c4818 100644 --- a/rule/ftpsyncfiles/rule_class.php +++ b/rule/ftpsyncfiles/rule_class.php @@ -206,11 +206,9 @@ private function download_files(int $did): void { ); echo "Downloaded $filename successfully." . PHP_EOL; // Delete the file from the remote server using cURL. - $deletech = curl_init(); - curl_setopt($deletech, CURLOPT_URL, $remotepath); - curl_setopt($deletech, CURLOPT_QUOTE, array("rm ".escapeshellarg("$remotepath")); - $deleteresult = curl_exec($deletech); - curl_close($deletech); + curl_setopt($filehandle, CURLOPT_URL, $remotepath); + curl_setopt($filehandle, CURLOPT_QUOTE, array("rm ".escapeshellarg($remotepath))); + $deleteresult = curl_exec($filehandle); if ($deleteresult === false) { echo "Failed to delete $filename on the remote server." . PHP_EOL; } else {