php - How can I tell if file is writable from script? -
my plugin needs able write file system. possible query known file write permissions?
for example, wordpress theme ships file called custom.css need write access to. when theme first loads, i'd query script see if writable, echo results theme.
then in support session's, can ask user visually check setting insure have write permissions expected (and eliminate cause of read/write issue).
is_writable("yourfilename.txt")
http://php.net/manual/en/function.is-writable.php
for example...
if (is_writable('custom.css')) { echo "success! custom.css writable"; } else { echo "failure!! custom.css not writable"; }
Comments
Post a Comment