Page 1 of 1

symlink and unlink

Posted: Tue May 08, 2007 1:15 pm
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]

Posted: Tue May 08, 2007 3:19 pm
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.