symlink and unlink

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ngungo
Forum Commoner
Posts: 75
Joined: Thu Jun 08, 2006 10:45 pm

symlink and unlink

Post by ngungo »

Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have trouble of using symlink(). If I tried to symlink a file from a non-public directory, it never works.

Code: Select all

if (!symlink('/nonpublic/path/protectedfile.txt', '/public/path/downloadablefile.txt')) die('Bad Symlink');
echo('Successful Symlink');
Now, if I tried to symlink a file from a public directory, it works ok except that can not unlink (delete).

Code: Select all

if (!symlink('/public/path/protectedfile.txt', '/public/path/downloadablefile.txt')) die('Bad Symlink');
if (!unlink(/public/path/downloadablefile.txt)) die("Bad Unlink");
echo('Successful Symlink and Delete');
I am all ears! Thanks in advance.


Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ngungo
Forum Commoner
Posts: 75
Joined: Thu Jun 08, 2006 10:45 pm

Post by ngungo »

Thanks and I am sorry Jcart. I know of this rule but since I jump back and forth among different forums I forgot.
Post Reply