-2
I would like to record input files in an xml document
public function do_upload()
{
$this->load->library('upload');
$len = count($_FILES['files']['name']);
$nomes = array();
for($i = 0; $i < $len; $i++) {
$fileSize = $_FILES['files']['name'][$i];
$string = str_replace(' ', '-', $fileSize);
$nomes[] = convert_accented_characters($string);
}
$this->load->library('xml_writer');
// Initiate class
$xml = new Xml_writer();
$xml->setRootName('playlist');
$xml->initiate();
// Start branch 'track'
$xml->startBranch('track');
$xml->addNode('title', 'exemple 1'); //Queria fazer um loop aqui para o valor exemple 1, ser o nome dos arquivos
$xml->endBranch();
// End branch 'track'
$xml->endBranch();
$data = array();
$data['xml'] = $xml->getXml(FALSE);
$this->load->view('xml', $data);
$this->upload->initialize(array(
"file_name" => $nomes,
"upload_path" => "./uploads/",
"allowed_types" => "mp3",
"max_size" => "30000"
));
}
I’m using the class https://github.com/bcit-ci/CodeIgniter/wiki/Xml-Library