![]() |
[ SOLVED ] Unlink problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [ SOLVED ] Unlink problem (/showthread.php?tid=5659) |
[ SOLVED ] Unlink problem - El Forum - 01-30-2008 [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 :) [ SOLVED ] Unlink problem - El Forum - 01-30-2008 [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; [ SOLVED ] Unlink problem - El Forum - 01-30-2008 [eluser]GreenDude[/eluser] works! ![]() Thanks a lot for the quick reply [ SOLVED ] Unlink problem - El Forum - 11-09-2008 [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. [ SOLVED ] Unlink problem - El Forum - 11-09-2008 [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. [ SOLVED ] Unlink problem - El Forum - 10-07-2009 [eluser]babelawra[/eluser] Hi, yeah old topic but effective. xwero's solution is cleaner but i used what CIfan1000 suggested and works perfectly ![]() Thanks [ SOLVED ] Unlink problem - El Forum - 02-25-2012 [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 [ SOLVED ] Unlink problem - El Forum - 02-25-2012 [eluser]InsiteFX[/eluser] You can also do it this way Code: $filestring = APPPATH.'../uploads/'.$filename; |