Jump to content

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 :)

Link to comment
https://forums.phpfreaks.com/topic/11535-help-with-imagedescription-uploading/
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.
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?
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');
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.