PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
azeemgujjar
Forum Newbie
Posts: 9 Joined: Wed Oct 15, 2008 3:18 am
Post
by azeemgujjar » Wed Oct 15, 2008 3:24 am
Hello Good Day To You!
i want to upload images to folder, and there path should be save in xml file.
xml scenario is like this
Code: Select all
<image>
<A>
<image id="img1" lbl="Illustrator" src="frames/a/A1.jpg" />
<image id="img2" lbl="Fireworks" src="frames/a/A2.jpg" />
<image id="img3" lbl="Lightroom" src="frames/a/A3.jpg" />
</A>
<B>
<image id="img2" lbl="Fireworks" src="frames/b/B1.jpg" />
<image id="img1" lbl="Illustrator" src="frames/b/B2.jpg" />
<image id="img3" lbl="Lightroom" src="frames/b/B3.jpg" />
</B>
so on.....
i will be greatly thankful if some one help me with this .... and give me some sample code...
Thank you
azeemgujjar
Forum Newbie
Posts: 9 Joined: Wed Oct 15, 2008 3:18 am
Post
by azeemgujjar » Wed Oct 15, 2008 8:39 am
i tried but not found
azeemgujjar
Forum Newbie
Posts: 9 Joined: Wed Oct 15, 2008 3:18 am
Post
by azeemgujjar » Wed Oct 15, 2008 12:27 pm
file upload is not a problem on google we have thousands of ways, the problem is how to save uploaded file path to xml as i post.
i want when i upload image after complete it should be save its path in xml, like this...
<image>
<A>
<image id="img1" lbl="Illustrator" src="frames/a/A1.jpg" />
<image id="img2" lbl="Fireworks" src="frames/a/A2.jpg" />
<image id="img3" lbl="Lightroom" src="frames/a/A3.jpg" />
</A>
<B>
<image id="img2" lbl="Fireworks" src="frames/b/B1.jpg" />
<image id="img1" lbl="Illustrator" src="frames/b/B2.jpg" />
<image id="img3" lbl="Lightroom" src="frames/b/B3.jpg" />
</B>
so on.....
hope you understand now what i mean... please somebody help me
thank you for your precious time...
omniuni
Forum Regular
Posts: 738 Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA
Post
by omniuni » Wed Oct 15, 2008 3:55 pm
How do you plan to get the information that goes along with the image?
Still, if you know where the image is going, it should be a simple matter of constructing a string and writing it to a file.
Assuming you are on PHP5+...
1. Read current file into a variable: $oldxml = file_get_contents('source.xml');
2. Modify String to include new data: $newxml = $oldxml.'<img><image id="'.$imageID.'" src="'.$imageSOURCE.'">.... (etc...)
3. Write back into the original file: file_put_contents('source.xml', $newxml);
Does that help a bit?
azeemgujjar
Forum Newbie
Posts: 9 Joined: Wed Oct 15, 2008 3:18 am
Post
by azeemgujjar » Thu Oct 16, 2008 4:18 am
thank you omniuni!
its really helpful for me, to understand what i need to do, thanks again...