I am using put_contents() function to put images on the server, works fine on localhost, though on server, the user group when the file are downloaded to server is "nginx nobody" and that is causing the images to return 404 error and not to be viewed, how can I make the file be downloaded with the default WordPress owner/group
global $wp_filesystem;
// Initialize the WP filesystem.
if (empty($wp_filesystem)) {
require_once (ABSPATH . '/wp-admin/includes/file.php');
WP_Filesystem();
}
$wp_filesystem->put_contents($save_file_to, $file_to_save, 0644)