file upload editable permission (7 posts)

  1. jasonvelocity
    Posted 12 years ago #

    After I upload a file via file upload, I can't put, get or chmod it. The perms are set at 600 after WP uploads it. If I manually upload the file, the perms are set at 664. I think I need a copy of your upload.php!

  2. Anonymous
    Posted 12 years ago #

    noackjr: I had the same problem, and I agree that this should definitely be a configurable item in file upload options. It isn't that big of a job to add the feature anyway.
    However, I don't understand how you got your code working. Shouldn't it be chmod($file, 0644) and not chmod($file, 644), i.e. OCTAL 644?

  3. noackjr
    Posted 12 years ago #

    Yes, you are correct -- I fixed that in WP but forgot to update the posted patch.

  4. Edlef
    Posted 12 years ago #

    i have the same problem since i changed my host...
    could somebody explain what i have to change where to get the permission set working?

  5. noackjr
    Posted 12 years ago #

    Add a 'chmod($pathtofile2, 0644);' line before the first '@unlink($img1);' line in wp-admin/upload.php and a 'chmod($pathtofile, 0644);' line before the second '@unlink($img1);' line. That's it!
    Some background:
    PHP uploads files to a temporary directory first and that file is copied to the final location (among other things, this allows size restrictions to be easily enforced). The chmod functions are run at the same time as this temporary file is removed.
    You can read up on chmod here:

  6. noackjr
    Posted 12 years ago #

    By the way, that's a dollar sign before "pathtofile" and "img".

  7. Matt Mullenweg
    Posted 12 years ago #

    This is fixed for 1.2.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.