Welcome Guest, Not a member yet? Register   Sign In
File helper
#1

[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";
delete_files($file_delete);

but does not work... so.. I try with the unlink

Code:
$file_delete = '/var/www/xmlrpc/listas/'.$nombre_lista.".txt";
unlink($file_delete);

and does not work either.. the file was created by the write_file method of the file helper...

any ideas?

Bye Smile
#2

[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
 
 
#3

[eluser]Seppo[/eluser]
I'm pretty sure unlink works ok using full paths.
Check if file_exists and is_writeable to check...




Theme © iAndrew 2016 - Forum software by © MyBB