How to grant permission to FileSystem.php file
First of all make sure that the files directory (sites/default/files by default) has the right owner and permissions.
And also directory of temporary files, in general /tmp if you don't have create one and give it the right permissions.