File helper - 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: File helper (/showthread.php?tid=3093) |
File helper - El Forum - 09-09-2007 [eluser]latuss[/eluser] Hi all... I'm working with files... the write_file works fine.. but.. how can I delete a file? I try with the Code: $file_delete = '/var/www/xmlrpc/listas/'.$nombre_lista.".txt"; but does not work... so.. I try with the unlink Code: $file_delete = '/var/www/xmlrpc/listas/'.$nombre_lista.".txt"; and does not work either.. the file was created by the write_file method of the file helper... any ideas? Bye File helper - El Forum - 09-09-2007 [eluser]John_Betong[/eluser] Hi latuss, I think the problem is that unlink(...) does not like directories/paths. I have vague memories of the same problem and my 'Kludge' was to: 1. save the directory where you are - getcwd() 2. change to the directory where the file exists - chdir() 3. unlink('the_file') 4. change back to the original directory. Cheers, John_Betong File helper - El Forum - 09-09-2007 [eluser]Seppo[/eluser] I'm pretty sure unlink works ok using full paths. Check if file_exists and is_writeable to check... |