WordPress.org

Forums

ownership of uploaded files (9 posts)

  1. larsfarm
    Member
    Posted 10 years ago #

    I tried marsedit and ecto to upload a few images via WordPress. WordPress puts the result in wp-contents. The directory I specified.

    The problem: These files are owned by "apache". I am not allowed by my webhotel to change ownership of these files. I can't rename them. I can't move them. More importantly, I can't remove them. I've tried via ssh and the site-admin interface. These files ("my" files) are not mine any longer...

    I can edit files via WordPress, but not remove or rename och change owner...

    What do I do?

    Lars

  2. larsfarm
    Member
    Posted 10 years ago #

    bump, anyone?

  3. lbessant

    Posted 10 years ago #

    You need to contact your host about this.

  4. larsfarm
    Member
    Posted 10 years ago #

    OK, is there some setting within WordPress that allows me to control ownership of uploaded files? or is this the intended behaviour?

    Lars

  5. Kafkaesqui

    Posted 10 years ago #

    Nope.

    File ownership for files uploaded through http are handled by the host system. Usually this is configured to default to a group or groups with privileges over a directory; for hosting, that's typically a group created specific to your site account. Your files are being given ownership to the server default. To *fix* it, as larsfarm noted, you need to contact your host.

  6. shelleyp
    Member
    Posted 10 years ago #

    If your host provides cpanel or another site control tool, you usually have access to a file management tool that will allow you to delete these files.

    However, this should be added to the bugs database for a 1.5.1 release, so that file uploads through the web API interface are also set with permissions that allow anyone to delete or move the files, not just the owner. WordPress image uploads work this way in 1.2 and up I believe.

  7. skp
    Member
    Posted 10 years ago #

    I have the same problem. The server is using IIS. When the file is uploaded with WordPress the ownership is given to Internet Guest Account and the permissions are different than the parent folder. I have another account that has ownership of the parent folder and I can't even change the ownership of the files uploaded inside the folder using that account. In fact, I can't even view the files if I am logged in on that computer as that user. I have checked the permissions for files uploaded using Coppermine and they work just fine. Maybe WordPress uploads using a different method?
    I am able to delete the files, however, if I FTP into the server. And when I upload a file using FTP the permissions are the same as the parent folder.
    I just checked right now and when a thumbnail is created when you upload the file, the permissions allow me to change the ownership. Maybe the upload script needs to be changed to upload to a temp file first and then copied to the final file. I think that should fix the problem.

  8. Tahongawaka
    Member
    Posted 10 years ago #

    You should be able to create a php script that will delete the files. It would be run by apache and pick up its permissions to delete the files. This has not been tested by me, but this (or something similar should work):
    <?php
    foreach (glob("*.jpg") as $filename) {
    echo "$filename size " . filesize($filename) . "n";
    // unlink($filename);
    }
    ?>

    Stick it in the directory you want to clean out and hit it from your browser. If you get the correct file names, un-comment out the line & run it again. It may time out, depending on the number of files, amount of disk activity, what not. If so, run again.

  9. skp
    Member
    Posted 10 years ago #

    I created an upload manager to delete the files. I made it as an extra tab under upload in 1.5. It's pretty basic. You can delete individual files or all of them.

    Check this post:
    http://wordpress.org/support/topic.php?id=27582

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.