Syntax of FS_CHMOD_DIR and FS_CHMOD_FILE

by MoritzLost   Last Updated January 05, 2018 11:08 AM

I ran into an issue today with files uploaded through the Wordpress Backend not getting the correct permissions. The permission on the new 2018 folder in the uploads directory as well as the files within it were too tight, the webserver user couldn't even access them. I found the constants FS_CHMOD_DIR and FS_CHMOD_FILE that can be used to overwrite the default permissions for uploaded files. The Wordpress Codex suggests using the the following settings in the wp-config.php:

define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) );

However, I haven't been able to find documentation on the syntax of those constants. The octal notation of the permissions is clear, but what is up with the ampersand, the swung dash and the umask command without a parameter? This article by wpbeginner mentions those constants as well, however it only mentions defining the constants with the octal values alone. What's the difference between that and the longer command above?



Related Questions



DISALLOW_FILE_EDIT constant being ignored

Updated June 30, 2017 14:08 PM


How to define constant before plugin

Updated September 14, 2017 10:08 AM

define() for array

Updated November 04, 2017 02:08 AM