image in XML file

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've some XML files used to update my datas in my database/server.

I've got how to retrieve all datas between xml tags, but I'm stuck when I've
to retrieve images datas:

    <PICTURES number=3 encoded=0>  //0 is for plain jpg, 1 is for CDATA
Base64 string
        <PIC name=pic1344_1.jpg number=1>

how to save the image on the server ?


Re: image in XML file

Bob Bedford wrote:

Quoted text here. Click to load it

put your base64 string inside a cdata tag
....insert base64 string here...

Re: image in XML file

Hi Terence, thanks for replying

Quoted text here. Click to load it

The CDATA tag already exists. My problem is what to do with it !

Do I have to put the base64 string in a $variable then save it in a file,
most probably I must decode the base64 problem is once I
encounter this tag, what should I do !

I've looked in and google, but couldn't find any answer.


Re: image in XML file

On Tue, 17 Aug 2004 09:37:46 +0200, Bob Bedford wrote:

Quoted text here. Click to load it

After reading the characters within the PIC tag (btw, why are all your
tags uppercase?) into a $variable, you may need to decode it (look at your
encoded attribute of the PICTURES tag).  At this point, you have the image
data and file name.  Open a file output stream, set the binary mode on the
stream, write the image data, then close the stream (this should
automatically flush the stream).

La'ie Techie

Site Timeline