Write input file names in xml

-2

I would like to write files from an input into 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 link

    
asked by anonymous 08.01.2015 / 16:37

1 answer

1

Getting resolved

foreach ($nomes as $value) {
        // Start branch 'track'
        $xml->startBranch('track');
        $xml->addNode('title', $value);
        // End branch 'bikes'
        $xml->endBranch();
    }
    
08.01.2015 / 17:42