Permission denied

Posted 3 years ago by Khudadad

I trying to delete a file from public directory but I'm facing with this error:

ErrorException in BookController.php line 119: unlink(F:\Projects\kpucollege\public/): Permission denied

this is my function in the Controller.

public function destroy($id)
{
    $book = Book::findOrFail($id);
    $book_path = public_path().'/'.$book->book_path;
    unlink($book_path);
    $book->delete();
    return redirect('admin/dashboard/books')->with('message','کتاب موفقانه حذف شد');
}

Thanks

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.