urgent need help about upload images

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

Post Reply
azeemgujjar
Forum Newbie
Posts: 9
Joined: Wed Oct 15, 2008 3:18 am

urgent need help about upload images

Post by azeemgujjar »

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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: urgent need help about upload images

Post by requinix »

Have you tried Google yet?
azeemgujjar
Forum Newbie
Posts: 9
Joined: Wed Oct 15, 2008 3:18 am

Re: urgent need help about upload images

Post by azeemgujjar »

i tried but not found :(
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: urgent need help about upload images

Post by aceconcepts »

Not the best intial post i've seen!!!

Take a look at the sites (found via Google):

http://www.tizag.com/phpT/fileupload.php

http://uk.php.net/features.file-upload
azeemgujjar
Forum Newbie
Posts: 9
Joined: Wed Oct 15, 2008 3:18 am

Re: urgent need help about upload images

Post by azeemgujjar »

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...
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: urgent need help about upload images

Post by omniuni »

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

Re: urgent need help about upload images

Post by azeemgujjar »

thank you omniuni!
its really helpful for me, to understand what i need to do, thanks again...
Post Reply