Page 1 of 1

unlink problem

Posted: Mon Jul 04, 2005 7:56 am
by hame22
Hi all having a small problem with an unlink command

this is my code

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnks';
}

when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnks

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnksame.php";

if (unlink($location))
{
print 'file deleted';
}

when i attempt to delemy code

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnksall problem with an unlink command

this is my code

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnksde

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete link command

this is my code

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnksall problem with an unlink command

this is my code

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?lete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnksk command

this is my code

Code: Select all

$location = "http://directory/filename.php";

if (unlink($location))
{
 print 'file deleted';
}
when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnks
$location = "http://directory/filename.php";

if (unlink($location))
{
print 'file deleted';
}

when i attempt to delete the file I recieve the following error:

"unlink(http://directory/filename.php) no such file or directory"

any ideas on what could be the problem?

thnks

Posted: Mon Jul 04, 2005 7:58 am
by Syranide
you cannot unlink webpages, that would make it possible for you to unlike the entire windows site (would probably make someone happy).

Unlink can delete local files, that is on the same server, or on a network drive used by the local server.

Posted: Mon Jul 04, 2005 8:00 am
by hame22
sorry my mistake, i am not trying to unlink a .php page should have said pdf which is held within my webserver, does this make any difference?

Posted: Mon Jul 04, 2005 8:07 am
by Chris Corbyn
Moved to PHP code. And Please use

Code: Select all

tags if you're going to post PHP code. code.post PHP code. And Please use

Code: Select all

tags if you're going to post PHP code.PHP code.tags if you're going to post PHP code. And Please use

Code: Select all

tags if you're going to post PHP code.

Posted: Mon Jul 04, 2005 8:11 am
by hame22
er? so any ideas why the pdf file is not removed from the webserver when i use the unlink command with the files address on the server?

Posted: Mon Jul 04, 2005 8:14 am
by Chris Corbyn
Web pages, files over HTTP, anything over HTTP... you can't do it.
HTTP is pretty much read-only.

You can delete from your own file system, a remote filesystem via SSH/FTP but not via HTTP like this.

EDIT | If this file is on your own web server, i.e. the one your script is running on then drop the http://domain portion. If PHP has write access to the file then it will work ;)

Posted: Mon Jul 04, 2005 8:16 am
by hame22
ok thanks, so i guess i'll have to go back to using addresses such as ../../files/file.pdf , i'm i right in thinking this?

Posted: Mon Jul 04, 2005 8:17 am
by Chris Corbyn
hame22 wrote:ok thanks, so i guess i'll have to go back to using addresses such as ../../files/file.pdf , i'm i right in thinking this?
Yes, see my EDIT above ;)