Getting Some Errors
Warning: ftp_delete(): Could not delete /public_html/mailfuse/templates/Test/TestTest/TestTest.mft: No such file or directory in /home/ziggy/public_html/sgtool/tools/index.php on line 135
Warning: fopen(/public_html/mailfuse/templates/Test/TestTest/TestTest.mft): failed to open stream: No such file or directory in /home/ziggy/public_html/sgtool/tools/index.php on line 138
There was a problem while creating TestTest.mft
//goes to the root directory
ftp_cdup($conn_id);
//deletes old .mft file
ftp_delete($conn_id, '/public_html/mailfuse/templates/'.$customerCompany[0].'/'.$nameFirst.$nameLast.'/'.$name2);
//checks if file exists else creates it
if(!fopen('/public_html/mailfuse/templates/'.$customerCompany[0].'/'.$nameFirst.$nameLast.'/'.$name2, 'w'))
{
echo "There was a problem while creating $name2\n";
}
else
{
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//sets files permissions
chmod ($dir2.$name2, 0774);
//checks if it can open file
if (!$handle = fopen($dir2.$name2, 'a'))
{
echo "Cannot open file ($name2)";
//closes the file
fclose($handle);
//closes the ftp connection
ftp_close($conn_id);
//quits the loop
exit;
}
if (!fwrite($handle, $somecontent, strlen($somecontent)))
{
echo "Cannot write to file ($name2)";
//closes the file
fclose($handle);
//closes the ftp connection
ftp_close($conn_id);
//quits the loop
exit;
}
echo "File $name2 created";
//closes the file
fclose($handle);
//closes the ftp connection
ftp_close($conn_id);
}