Welcome Guest, Not a member yet? Register   Sign In
deleting a file?
#1

[eluser]dadamssg[/eluser]
I'm trying to delete/unlink a file. I don't know if the error is being cause by codeigniter or not. I don't know if codigniter has its own unlink function. I couldn't find one.

I'm getting this error:

A PHP Error was encountered

Severity: Warning

Message: unlink() [function.unlink]: http does not allow unlinking

Filename: controllers/slideshows.php

Line Number: 151


anybody have any suggestions?

edit for more information:

i'm using this to upload and its working. --- $config['upload_path'] = './photos/';

and i've tried this

Code:
$photo = $this->photos_model->get_photo($photo_id);
        $photo_name = $photo['name'];
        
        $file = "./photos/$photo_name";
        
        //delete file from directory
        unlink($file);

but i'm getting this errror

A PHP Error was encountered

Severity: Warning

Message: unlink(./photos/10_1311449383_2.jpg) [function.unlink]: No such file or directory

Filename: controllers/slideshows.php

Line Number: 152

i don't think i'm referencing the directory right...
#2

[eluser]dadamssg[/eluser]
nevermind! i'm an idiot.

I eventually got the path right without knowing it and it was deleting. BUT i hadn't written a function to delete the photo record from the db, hence the second error in my original post.




Theme © iAndrew 2016 - Forum software by © MyBB