GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


joomla:write_to_a_file_on_disk
function WriteFile($path,$filename,$content) {
    $file = JPATH_ROOT.'/'.$path."/".$filename;
    // the write coding
    JFile::write($file, $content);
}

This simple Joomla function leverages the framework to write a file to disk.

Use it like this

WriteFile('media','my_file.txt','This will be written to the file');

Which will write a file called my_file.txt into the folder ./media within your Joomla installation. You'll need to make sure the location is writeable.

/home/gen.uk/domains/wiki.gen.uk/public_html/data/pages/joomla/write_to_a_file_on_disk.txt · Last modified: 2019/05/20 10:13 by genadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki