• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

search and compare in an external directory

New Here ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

I am still a relative neophyte to the world of ColdFusion, but I have created some fairly sophisticated real estate applications. I have an issue that I need to solve and I’m not sure exactly how to approach it. I’m thinking that the solutions will most likely involve some ColdFusion and perhaps some other techniques, but I’m not sure.

Here’s the situation:
Located on a server that is external to my application is a directory that has in it a large number of image files. The image files are all named under a very specific naming convention. These images are for real estate listings, and the filenames are the MLS number for that listing followed by _1, _2, _3, etc. depending on how many images are associated with that particular listing.

What I need to be able to do is: (a.) check for the existence of any image associated with a particular listing (some may have no images) and (b) count the number of images associated with a listing by performing some sort of search an compare function with a count.

I have no idea if this is possible using ColdFusion or what would be the best way to tackle this. Any suggestions would be appreciated. Thanks in advance.

Joe
TOPICS
Advanced techniques

Views

572

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

You could do what you desire fairly easily with the <cfdirectory...>
tag. See the documentation for all the details.

Whether or not this will succeed will depend on how your ColdFusion
server is networked to this image server. If they can talk to each
other it should be possible, if they can not because of network
configuration/security then it will be much more difficult.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

Make sure that the login name used by the coldfusion service has access to the directory in question.

Use the CFDIRECTORY tag to create your record set.

query the directory to check for the existence of records that where the file name contains the MLS number in question.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

It sounds to me that the files exist on a different server than the one running the application. If so, CFDIRECTORY won't work. I think that the solution is to use CFHTTP.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

Thanks to both of you for your quick replies. jdelineIt, you're right, the images reside on another server that isn't running ColdFusion so I will need to find a solution that doesnt involve CFDIRECTORY. Could you give me a brief rundown on the properties of CFHTTP and how I could use it for this particular problem? I'm not at all familiar with it. Thanks.

Joe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

the images reside on another server that isn't running ColdFusion so I
will need to find a solution that doesnt involve CFDIRECTORY.

You can use cfdirectory on the coldFusion server just as long as you can
log into that server as the user under which the ColdFusion service is
running and then navigate to the images server though the file system.

Now the default ColdFusion user is "localSystem" on windows. And this
user would not normally have any permissions to resources not on the
local box. But if you can provide a user that does have the necessary
permissions then this kind of cross network access is quite easy to do.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

Here is article on how to setup you ColdFusion service to run under a user account you specify. Running ColdFusion as a specific user.

Give the user account you run ColdFusion as rights to the image directory and you can access it with cfdirectory and cffile.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

If so, CFDIRECTORY won't work. I think that the solution is to use CFHTTP.

CFDirectory can work just fine just as long that the user that the
ColdFusion service runs under has the correct permissions to read the
other server's resources. One just uses a basic UNC path in the
<cfdirectory...> tag. I.E. <cfdirectory
directory="\\aRemoteServer\aDirectory\aFile.AnExtenstion" ...>

CFHTTP will only work if the other server is a web server that responds
to http requests. If it is just a kind of file server or something it
will not respond to the <cfhttp...> tag.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 19, 2007 Apr 19, 2007

Copy link to clipboard

Copied

LATEST
I use CFDIRECTORY on other servers just fine. As has been stated, the key is that the cf login username needs permissions on the remote directory.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation