[Webinar] Streamline your web hosting managementRegister Today


Read from directory add to db

Posted on 2005-04-05
Medium Priority
Last Modified: 2013-12-24

I am running CFMX 7 on our own server Win 2003. 800gb space,

I have just set up a new web directory structure with over 6000 images in it set up like below.

wwwroot/pics/summmer/img_2453663_66357.jpg  (etc)
wwwroot/pics/winter/img_2453663_66311.jpg  (etc)

Lots of folders with hundreds of images in each.

What i need to do is for coldfusion to read the name of the images, and store it and it's route on a db (don't worry about the storage code that is not a problem)

Something behind this... I have an co located server with 600 thumbnails on it live, the order form is currently sent to the account manager who finds the 300dpi image on the server and sends it out on a CD, as you can see this is not the best way.

What i have is set up our inhouse server with the 300dpi images on, i am going to pass the image name accross from the current order form and send out the image.

I do not want to type in 6000+ image names and locations?

Please any help?
Question by:zakaz
LVL 20

Expert Comment

ID: 13710162

This is just an idea and somthing I haven't tried before, but may be of some use???

<cffile    action = "read"    
             file = "../pics/summmer/"  
             variable = "pic_locations"   >


I don't have any idea if this will work, at the moment I don't have anythnig to test on either :o)

just an idea...

Expert Comment

ID: 13711093
Are you wanting to do this as images are uploaded to the server as part of a web app?  Do you just want to be able to find an image based upon it's name?  There are a couple of different approaches based upon your unique requirements and all should be rarther simple.  Can you give us a little more information to work with?
LVL 20

Expert Comment

ID: 13711454
I'm not sure exactly how to go about this,

but what I believe he is asking is how to dynamically populate a database record say "Image_Name" with the name of images in a directory (he says about 600 worth) and store another value "Image_Location" with the path to those images in a table without having to hand cramp everything to the table...

by say storing the values as variables and doing an SQL insert to update his new database.

I would also be interested if you have an easy way of doing this!

I think then he can use this table to call images on a variety of pages with his new database..?

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 12

Accepted Solution

mmc98dl1 earned 1500 total points
ID: 13712695
We did this a while back, cfdirectory is your friend:
This is done with no testing, so you may need to tweak it a bit.

<cfdirectory action="list" name="pics" directory="c:/wwwroot/pics/" >

<cfloop query="pics">
      <cfdirectory action="list" name="this" directory="c:/wwwroot/pics/#pics.name#">
      <cfloop query="this">
            <!--- this.name contains all the file names in your directory --->
            <!--- You can use this info to store in db --->

Author Comment

ID: 13714954
Excellent work you guys,

I will give these a taet today,

Thank You all,


Author Comment

ID: 13715803
<p>The template path of the current page is:

<cfdirectory action="list" name="pics" directory="E:\wwwroot\Clients\b\bdw\images\" >

  <cfloop query="pics">
     <cfdirectory action="list" name="this" directory="E:\wwwroot\Clients\b\bdw\images\#pics.name#">
     <cfloop query="this">
          <!--- this.name contains all the file names in your directory --->
          <!--- You can use this info to store in db --->

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
This installment of Make It Better gives Media Temple customers the latest news, plugins, and tutorials to make their Grid shared hosting experience that much smoother.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question