Jump to content

Archived

This topic is now archived and is closed to further replies.

perezf

Help with image/description uploading

Recommended Posts

Hello everyone, I'm stuck on a website that I am building for my neighbor. He's a used car dealer, and wants to have on his website the ability to upload 5 pictures of 1 car(he's going to have multiple cars of course) and a description of the car. (mileage, make, etc.) I know the code for uploading multiple pictures to a directory already, but I need help with uploading a description that he types for the pictures. Problem is, I'm trying to make this with PHP but not using a database, but i'm not really up to that level yet. Could someone help me out with this code so I can get this project over with? It would be very appreciated :)

Share this post


Link to post
Share on other sites
You can orginze your data in folders so sorting and getting the info will be easier (without a database)

for example
for each new car, you make a directory with the car name (for example hona_civic)

When he uploads the images (each car pictures will go into its' own folder) save them with specific names (like pic_1.jpg pic_2.jpg, pic_3.jpg etc)

and save the description as files in the same folders (like desc_1.txt, desc_2.txt, desc_3.txt)

This way each picture will have it's own description.

Hope this helps.

Share this post


Link to post
Share on other sites
thank you for replying nogray.

That was the idea I had going a while ago, but what he wants would be 5 pictures on a page (like in a directory folder like you said) and the description will appear at the bottom of the pictures. Now I'm wondering if there's any possible way that if when he saves the description like you said in a .txt file in the same directory, I can code something that will call in that description on the bottom of the page (almost like an include). What would you think?

Share this post


Link to post
Share on other sites
That's possible, just read the text file:[code]$desc = file_get_contents('desc_1.txt');[/code] and then echo it wherever you want. You could loop through the images in the directory, incrementing a variable such as $i as you go and then just use it to match the picture to the text. So if you were on pic_3.jpg, $i would also be at 3 and then you can just echo file_get_contents('desc_' . $i . '.txt');

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.