function admin_batch_xml_stock_update() { App::import('Xml'); if (!empty($this->data)) { $path = WWW_ROOT . 'files\\'; //lokacija POSTanega fajla $xml = $this->data['Product']['file']['tmp_name']; $xmlName = $this->data['Product']['file']['name']; $file = new File($xml); $xmlContent = $file->read(); $file->close(); //shranjevanje XMLa na server $file = new File($path . $xmlName, true); $file->write($xmlContent); $file->close(); //branje XMLa v polje $parsed_xml = new Xml($path . $xmlName); $parsed_xml = Set::reverse($parsed_xml); //izvedba posodobitve nad produkti $this->Product->batch_xml_update($parsed_xml); $this->Session->setFlash('Xml update successful!'); } }