[ SOLVED ] Unlink problem |
[eluser]GreenDude[/eluser]
I tried to use the unlink() function but I get an error I don't understand. Code: $filestring = base_url().'uploads/'.$row->filename.$row->ext; Quote:A PHP Error was encountered Any ideas why? I am aware that this might be a newbie-ish problem :)
[eluser]xwero[/eluser]
you need the full path for the unlink function. I've added a constant to the index.php for these situations Code: define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION)); Code: $filestring = PUBPATH.'uploads/'.$row->filename.$row->ext;
[eluser]CIfan1000[/eluser]
PS I had the same problem and found a different solution than the above. See http://ellislab.com/forums/viewthread/45478/ The path simply needs to be relative to the directory that contains the CI index.php file. Code: // Delete the image of the harddisk: This worked just fine.
[eluser]hugle[/eluser]
[quote author="xwero" date="1201726096"]you need the full path for the unlink function. I've added a constant to the index.php for these situations Code: define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION)); Code: $filestring = PUBPATH.'uploads/'.$row->filename.$row->ext; Nice sollution, thank you.
[eluser]babelawra[/eluser]
Hi, yeah old topic but effective. xwero's solution is cleaner but i used what CIfan1000 suggested and works perfectly ![]() Thanks
[eluser]Cesar Kohl[/eluser]
"The path simply needs to be relative to the directory that contains the CI index.php file." That's perfect! Thanks Cifan1000
[eluser]InsiteFX[/eluser]
You can also do it this way Code: $filestring = APPPATH.'../uploads/'.$filename; |
Welcome Guest, Not a member yet? Register Sign In |