Support » Requests and Feedback » file upload editable permission

  • Yahoo! Web Hosting uploads files with permissions of 600 (regardless of directory permissions). This makes the files not readable by the web server. I had to add a couple chmod 664 lines to wp-admin/upload.php to get it work for me:
    wordpress.diff
    Having the chmod value as a user-editable option on the file uploads options page would be (IMHO) a pretty easy and useful change.

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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!

    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?

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

    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?
    thanks

    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:
    http://www.php.net/chmod

    By the way, that’s a dollar sign before “pathtofile” and “img”.

    This is fixed for 1.2.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘file upload editable permission’ is closed to new replies.