perezf Posted June 8, 2006 Share Posted June 8, 2006 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/11535-help-with-imagedescription-uploading/ Share on other sites More sharing options...
nogray Posted June 8, 2006 Share Posted June 8, 2006 You can orginze your data in folders so sorting and getting the info will be easier (without a database)for examplefor 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. Quote Link to comment https://forums.phpfreaks.com/topic/11535-help-with-imagedescription-uploading/#findComment-43436 Share on other sites More sharing options...
perezf Posted June 8, 2006 Author Share Posted June 8, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/11535-help-with-imagedescription-uploading/#findComment-43437 Share on other sites More sharing options...
Fyorl Posted June 9, 2006 Share Posted June 9, 2006 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'); Quote Link to comment https://forums.phpfreaks.com/topic/11535-help-with-imagedescription-uploading/#findComment-43456 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.