Everything works but the unlink(), which says permission denied. I've tried lots of different methods for chmod'ing the old photo and the new photo upon upload, as well as the folder where the photos are stored.
Code: Select all
$myphotofilename = str_replace(" ", "_", $_FILES["writer_photo"]["name"]);
$oldphoto = $myrow["photofilename"];
//rename($photos_path . $myrow['photofilename'], $photos_path . $myphotofilename);
//copy the file to some permanent location
if (move_uploaded_file($_FILES["writer_photo"]["tmp_name"], $photos_path . $myphotofilename)) {
echo "<p>File uploaded to: " . $photos_path . $myphotofilename . "\n";
chmod ($photos_path, 0777); // octal; correct value of mode
chmod ($photos_path . $myphotofilename, 0777); // octal; correct value of mode
//let's delete the old photo
chmod ($photos_path . $oldphoto, 0777);
unlink($photos_path . $oldphoto);
}File uploaded to: D:/path/photos/drew1.jpg
Warning: unlink(D:/path/photos/) [function.unlink]: Permission denied in D:\path\writer_details.php on line 89
Any ideas would be greatly appreciated! I'm sure I'm doing something wrong.