< ? $xml = "test01.xml"; $xmlData = simplexml_load_file($xml); foreach ($xmlData->img as $img) { $title = $img->title; $fname = $img->fname; $imgtxt = $img->imgtxt; } $imgtxt_base64_decode = base64_decode($imgtxt); file_put_contents($fname,$imgtxt_base64_decode); echo "title:" . $title . "< br />"; echo "filename:" . $fname . "< br />"; echo "< img src = '" . $fname . "' />"; ?>