WordPress.org

Support

Support » How-To and Troubleshooting » Delete uploaded files in 2.0.1?

Delete uploaded files in 2.0.1?

  • Why are uploaded files not deleted from the server when I use the “Delete” command? WP asks me to confirm “Delete this file from the server” but noooo, the file is still there. Removed from the database yes, but not the file itself.

Viewing 6 replies - 1 through 6 (of 6 total)
  • check the directory permissions, that maybe the culprit.

    If you mean uploaded via WordPress it normally means the files and the directories created by the PHP is owned by the web servers user. You as the owner of the script and everything else on your account have in that case no right to alter or delete these files and directories.

    That’s how it works by my service provider. It’s a security matter that seems to unsolved, at least it the web server is Apache.

    If someone has a solution to this, except uploading via FTP, please let us know.

    Yes, I meant the new uploading feature in WP admin. The file and folder permissions seems right, no problems there.

    Maybe I have found the problem:
    In the database, table “postmeta”, the “meta_value” (file path) doesn’t have slashes correctly written and there is some odd characters in the path. I’ve tried changing this path manually (after uploading a file) and that makes the delete function work (for that file only of course).

    Maybe this is a bug in WP?

    Don’t know if it makes a difference, but I’m on a Windows Srv 2003 machine, running Apache 2.0.55, PHP 5.03 and MySQL 4.1.16.

    I’m running my blog under Appache on a Unix system, and if I select the uploaded image in the Write/Post upload widget, the popup options ( covering the thumbnail ) contains a delete option. Pressing that option deletes the image from the upload directory. How this works on a Windows system, I don’t know.

    Maybe someone else here runs under Windows/Appache?

    Problem solved…?
    I have no idea what I’m doing, maybe someone more qualified has a better solution.

    On row 338 in functions-post.php I changed:
    add_post_meta($post_ID, '_wp_attached_file', $file);
    to
    add_post_meta($post_ID, '_wp_attached_file', quotemeta($file)); and now deleting files works fine.

    I’ve just tested your patch on a LAMP setup and it works just fine. I’ll submit it to trac for you. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Delete uploaded files in 2.0.1?’ is closed to new replies.