Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools

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.

/data/webs/external/dokuwiki/data/pages/joomla/write_to_a_file_on_disk.txt · Last modified: 2019/05/20 10:13 by genadmin

Was this page helpful?-11+1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki