Let say I want create file call style.css in /css/ folder.
/css/
Example : When I click Save button script will create style.css with content
style.css
You can use the is_writable function to check whether the file is writable or not.
For example: