Jump to content

Recommended Posts

weird.. try this see what happens

*untested

 

<?php
if (file_exists($file))
{
if(chmod ($file, 0777))
{
	if (unlink($file)) {
		echo "Deleted $file";
	} else {
		echo "cant Deleted $file";
	}
}else{
	echo "Can't change rights";
}
}else{
echo "No file exists";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/73192-unlink-file/#findComment-369193
Share on other sites

Okay..

you may need to change the access right of the public_html, do you know what they are set to ?

or the server may have some restrictions..

 

i guess you could try via FTP....

<?php
$file = "test.txt";
$ftpUserName = 'username';
$ftpUserPass = 'userpass';
$ftpServer = 'ftp.example.com';

  $ftpConn = ftp_connect($ftpServer);

  if (!$ftpConn) {
    die("Unable to connect to $ftpServer");
  }

if (@ftp_login($conn_id, $ftpUserName, $ftpUserPass)) {
   echo "Connected as $ftpUserName @ $ftpServer";
}
else {
   echo "Couldn't connect as $ftpUserName";
   ftp_close($ftpConn);
   die("Closed connection to $ftpServer");
}

echo ftp_chmod($ftpConn, 0777, $file) ? "CHMOD successful!" : 'Error';

// try to delete $file
if (ftp_delete($ftpConn, $file)) {
echo "$file deleted successful\n";
} else {
echo "could not delete $file\n";
}

// Close the connection
ftp_close($conn_id);
?>

Link to comment
https://forums.phpfreaks.com/topic/73192-unlink-file/#findComment-369218
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.