Although I have changed it to post here because I don't want to reveal the exact directory structure, it is trying to write to the correct directory (represented in my code here by /path/to_image/file.jpg). It is not letting me delete something not in the same directory as my PHP file.