⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Writing files to server



mrwrnf

mrwrnf
  • profile picture
  • Member

Posted 03 October 2016 - 18:37 PM

Hello, Need some pointing in the right direction.

 

Very glad to found Grocery CRUD, and have been working on learning the call back feature if it can do something like this, what I'm trying to do is query a file name and get some data and write it to a file on the server.

 

I'm looking to access the array that Grocery CRUD makes when it post the data to the database and this would need to take place before insert record to create the file for the first time and before update record too as each time the record is updated the file needs to be rewritten

 

id

Field one ['filename']

Field two ['somecontent']

 

$this->load->helper('file');

$filename = $value['filename']; // This is coming from the field that contains the file name like "myfile.txt
$somecontent= $value['filename']; // My Text from the database

if ( !write_file('../serverfolder/$filename, $somecontent)) {
     echo 'Unable to write the file';
}

 

Thank you for any help I really appreciate it.