Jump to content

how to delete files?


herando

Recommended Posts

[!--quoteo(post=376962:date=May 25 2006, 06:27 AM:name=herando)--][div class=\'quotetop\']QUOTE(herando @ May 25 2006, 06:27 AM) [snapback]376962[/snapback][/div][div class=\'quotemain\'][!--quotec--]
i choose a file from a form field and upload to folder and write a file name to table. when i delete a row, it deletes only file names from table. how to delete a corresponding file when a row is deleted?

row delete line:

$sql_del="DELETE FROM $data_table WHERE id='$id'";
[/quote]

I think what your looking for is:

$filename= "/tmp/test.file";
if(!unlink($filename)){
echo "file deleted";
}else{
echo "failed to delete file";
}
Link to comment
https://forums.phpfreaks.com/topic/10425-how-to-delete-files/#findComment-38889
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.