Delete uploaded files in 2.0.1? (7 posts)

  1. Wheee
    Posted 10 years ago #

    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.

  2. scaturan
    Posted 10 years ago #

    check the directory permissions, that maybe the culprit.

  3. petit
    Posted 10 years ago #

    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.

  4. Wheee
    Posted 10 years ago #

    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.

  5. petit
    Posted 10 years ago #

    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?

  6. Wheee
    Posted 10 years ago #

    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);
    add_post_meta($post_ID, '_wp_attached_file', quotemeta($file)); and now deleting files works fine.

  7. skeltoac
    Posted 10 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.