jrm2k6/cloudder

Cannot delete file with the delete() method

mbengchan opened this issue · 10 comments

i am unable to delete files using the methods provided. Here is my code:

Cloudder::delete($publicId, null);

Or

Cloudder::delete($publicId, array('folder' => 'users/'));

no error but when i check my dashboard file is still there.

Hi @shadomax Thanks for opening an issue. Let me give it a look.

It seems to be working fine for me. I tried using delete and destroyImage and it deletes the picture correctly.
Are you sure the publicId you are passing is the correct one?
delete / destroyImage returns a boolean if the deletion was successful, can you verify the return value of your call?

It's working fine when i don't upload into a folder. But when i upload into a folder the delete doesn't work

@jrm2k6 please can i see your example of deleting a picture found in a folder called samples.
Here is the directory structure: samples/test.png

How do you delete such a file. Please for the syntax

Sure, sorry for not replying earlier. I don't get notification emails for some reason.

I just pass the public id (in the case of the example: Cloudder::delete('samples/test.jpg);

Probably not related, but since i just dealed with this:

In the case you're binding model events to some sort of Photo model, make sure you're calling the ->delete() on the model instance, not in the QueryBuilder witch doesnt trigger the deleting/deleted events ¬¬'

Thanks @jrm2k6 it worked.

What's the difference between delete and destroyImage?