CodeIgniter Forums
Delete files from directory - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Delete files from directory (/showthread.php?tid=9493)

Pages: 1 2


Delete files from directory - El Forum - 06-27-2008

[eluser]Zeeshan Rasool[/eluser]
Hi, anyone here that tell me about this prob.This is function in model i want to delete uploaded video file from folder './public/videos'

$this->db->where('video_id', $video_id);
$this->db->select(trim('video_path'));
$query = $this->db->get('help_video');
foreach($query->result() as $item)
{
$old_video_path=($item->video_path);
}
delete_files('./public/videos/'.$old_video_path);
$this->db->where('video_id', $video_id);
$this->db->delete('help_video');


Problem:the information such as video title and path is deleted from DB but video file is still in directory. What shud me do!
.....thnx in Adv.



Delete files from directory - El Forum - 06-27-2008

[eluser]Zeeshan Rasool[/eluser]
I got it!

unlink(’./public/videos/’.$old_video_path); works fine.

i have used that code instead of using delete_files

thnx.


Delete files from directory - El Forum - 06-27-2008

[eluser]flojon[/eluser]
Demanding people to help you isn't very polite and will only turn people away from helping you.
Also I suggest the next time you need help you use subject that describes your problem

Regards,
Jonas


Delete files from directory - El Forum - 06-27-2008

[eluser]Référencement Google[/eluser]
Agreed with Flojon. And also don't worry, we see your posts and don't need to give them an "urgence", CI community is very helpful and will help you really quickly without you have to ask in an emergency.

Also please as already suggested yesterday to you, when you post code, use the Code tags to wrap your code in, it's unreadable otherwise !


Delete files from directory - El Forum - 06-29-2008

[eluser]Zeeshan Rasool[/eluser]
ok guys sorry! next time it will not happen again.


Delete files from directory - El Forum - 07-16-2008

[eluser]Unknown[/eluser]
wooowww... this is really what i've been lookin for.
my 1 hour work with delete_files function now solved! thx so much


Delete files from directory - El Forum - 09-10-2009

[eluser]dimazarno[/eluser]
nice one.., it really helps me

thx


Delete files from directory - El Forum - 09-10-2009

[eluser]BrianDHall[/eluser]
For extra safety (and to avoid errors) you might want to take a look at "is_file()" native PHP function.


Delete files from directory - El Forum - 09-10-2009

[eluser]InsiteFX[/eluser]
Also please use code tags when submitting code, it's easier to read.

Enjoy
InsiteFX


Delete files from directory - El Forum - 11-24-2009

[eluser]Thug_Angel[/eluser]
wow...
spent the last hour trying to figure out if i did something wrong when using delete_files();
when "unlink" function was there all along Sad

anyone knows what the reason might be for
Code:
delete_files('./public/videos/'.$old_video_path);
not working?
i even try loading helper file directly in my function.