> Since you've said you've got the parsing sorted, that must just leave
decoding
and saving.
Looks like it's base64 encoded, so:
Here is the code, but probably the problem is somewhere else:
if(isset($datas["PICTURES"])){
while(list($k,$v) = each($datas["PICTURES"])){
if(is_array($datas["PICTURES"][$k])){
while(list($k1,$v1) = each($datas["PICTURES"][$k])){
echo($k1."->".$v1."<br>");
if($k1 == 'PIC'){
echo(base64_decode($v1)."<br><br>"); //print to screen
if($imgfile =
fopen($UserID.'-'.$datas["NUM"].'-'.$num.'.jpg','wb')){
fwrite($imgfile,base64_decode($v1));
fflush($imgfile);
fclose($imgfile);
}
else
echo('error creating output file');
}else
$num = $v1;
}
}
}
}
Parsing: got the code on php.net:
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
rename($XMLPath.$file, $XMLPath.$failpath.$file); //move file in error
path
}
}
the XML structure
<PICTURES COUNT="3">
<PIC NR="1"><![CDATA[/9j/4AAQSkZJRg...............
if I try to print on the screen with "echo(base64_decode($v1)."<br><br>");"
I get line of different size and the created files are 1ko ! They should be
bigger ! Any idea ??? any string limit, a problem in the parser ???
Cheers
Bob