Changes to fix issues image uploads

The main problem was with Apache's header to env conversion. The underscore '_' is considered an invalid character in a header name, and is no longer accepted as of Apache 2.4.  Also X- prefixes are no deprecated by IETF in RFC 6648. Custom headers renamed with dash '-' which is translated to an underscore when converted to a name as seen in $_SERVER in php.

Also, small cleanup for a umask issues when creating new directories,