FileExists using variable - not working

2010-04-08 Thread Fred Grainger
Ok - I'm about to pull my hair out. I am using fileexists() function to determine whether a image file exists on the server. When I type in the path it works fine, but when I use a variable it always returns false. My code is like this: cfset variables.ImageSource =

Re: FileExists using variable - not working

2010-04-08 Thread Dorioo
To troubleshoot, one, the pounds are not needed so I'd take those out. Two, in cfelse, what is the value of: cfoutput#variables.ImageSource#cfoutput do something else In other words, what is the variable's value as soon as you hit cfelse. - Gabriel On Thu, Apr 8, 2010 at 1:03 PM, Fred

Re: FileExists using variable - not working

2010-04-08 Thread William Seiter
try cfif FileExists('#variables.ImageSource#') or cfif FileExists(variables.ImageSource) -- William E. Seiter On Apr 8, 2010, Fred Grainger i...@fredgrainger.com wrote: Ok - I'm about to pull my hair out. I am using fileexists() function to determine whether a image file exists on

Re: FileExists using variable - not working

2010-04-08 Thread Cutter (ColdFusion)
We use this all over, though you don't need the hash marks. Steve Cutter Blades Adobe Community Professional - ColdFusion Adobe Certified Professional Advanced Macromedia ColdFusion MX 7 Developer Co-Author of Learning Ext JS http://www.packtpub.com/learning-ext-js/book

Re: FileExists using variable - not working

2010-04-08 Thread Dave Watts
I am using fileexists() function to determine whether a image file exists on the server. When I type in the path it works fine, but when I use a variable it always returns false. My code is like this: cfset variables.ImageSource = C:\somedirectoy\somefile.txt cfif

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
Tried: cfif FileExists(#variables.ImageSource#) cfif FileExists('#variables.ImageSource#') cfif FileExists(#variables.ImageSource#) cfif FileExists(variables.ImageSource) None of which works. ~| Want to reach the ColdFusion

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
The value of the variable is: C:\somepath\filename.png Which is correct. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive:

Re: FileExists using variable - not working

2010-04-08 Thread Ian Skinner
On 4/8/2010 10:26 AM, Fred Grainger wrote: Tried: cfif FileExists(#variables.ImageSource#) cfif FileExists('#variables.ImageSource#') cfif FileExists(#variables.ImageSource#) cfif FileExists(variables.ImageSource) None of which works. Just a shot in the dark, cfif

Re: FileExists using variable - not working

2010-04-08 Thread Dave Watts
The value of the variable is: C:\somepath\filename.png Which is correct. When I was testing this a few minutes ago, I noticed that when I made changes to the fileExists function, the file wasn't being recompiled - I had to make some other change (any other change) and save the file again.

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
How can you tell when a template is recompiled? I made some changes and tried again. Still no dice? I'm outputting the variable and it looks correct, unless there is a control character or something in the string that I cannot see. I am thinking this might be the issue. The file name was

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
It is the correct path and file name. C:\somepath\filename.png I am thinking that there may be a control character of something that I cannot see. I am reading the filename.png from SQL Server. ~| Want to reach the

Re: FileExists using variable - not working

2010-04-08 Thread Dave Watts
How can you tell when a template is recompiled? You can attempt to identify the compiled file in the WEB-INF/cfclasses subdirectory, and look at the timestamp. I made some changes and tried again.  Still no dice? I'm outputting the variable and it looks correct, unless there is a control

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
Tried: cfif FileExists(#variables.ImageSource#) cfif FileExists('#variables.ImageSource#') cfif FileExists(#variables.ImageSource#) cfif FileExists(variables.ImageSource) cfif FileExists(trim(variables.ImageSource)) None of which works. The fileExists function expects a string literal. Wrap

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
Took the hash marks out. Put quotes, trimmed the variable, checked the length of the file name to make sure there weren't any control characters or anything. My code is very straight forward. A day and a half later, still no dice. This is the first time I've used this function. We just

Re: FileExists using variable - not working

2010-04-08 Thread Dave Watts
Took the hash marks out.  Put quotes, trimmed the variable, checked the length of the file name to make sure there weren't any control characters or anything.  My code is very straight forward. A day and a half later, still no dice.  This is the first time I've used this function.  We

Re: Re: FileExists using variable - not working

2010-04-08 Thread William Seiter
try: cfset variables.blah = '[filelocation filename you know exists]' cfif fileExists(variables.blah) Success!! cfelse Failed!! /cfif cfdump var=#variables.blah# -- William E. Seiter On Apr 8, 2010, Fred Grainger i...@fredgrainger.com wrote: Took the hash marks out. Put quotes,

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
Yep - If it type in a literal into the variable it is working. When I build the file path from the database fields it will not work. When I manually cut and paste the cfoutput of the variable I build with the database fileds into the fileexists function it finds it. It does not like

Re: FileExists using variable - not working

2010-04-08 Thread Wil Genovese
I was digging into Adobe's docs to see if something change. 1. Their examples are terrible. It's amazing anyone learns anything from those. 2. Nothing noted about changed behavior. So I took their example and fixed it so it would work. Try this. h3FileExists Example/h3 cfset thisPath =

Re: FileExists using variable - not working

2010-04-08 Thread Roger Austin
Fred Grainger i...@fredgrainger.com wrote: Yep - If it type in a literal into the variable it is working. When I build the file path from the database fields it will not work. When I manually cut and paste the cfoutput of the variable I build with the database fileds into the

Re: FileExists using variable - not working

2010-04-08 Thread Wil Genovese
You said that When I build the file path from the database fields it will not work. . Lets see that code. Something may not be what it seems to be. Wil Genovese One man with courage makes a majority. -Andrew Jackson A fine is a tax for doing wrong. A tax is a fine for doing well. On Apr

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
Have you tried checking the length of the string? Sometimes, you get a CR/LF at the end with Excel. -- http://www.linkedin.com/pub/roger-austin/8/a4/60 http://twitter.com/RogerTheGeek http://www.misshunt.com/ Home of the Clean/Dirty Magnet http://www.ncdevcon.com/ TACFUG 2010

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
You said that When I build the file path from the database fields it will not work. . Lets see that code. Something may not be what it seems to be. cfset variables.ImageSource = 'C:\Inetpub\wwwroot\Interspire\images_originals\cfoutput#trim(catalog.sku)#/cfoutput.png' The value is:

Re: FileExists using variable - not working

2010-04-08 Thread Wil Genovese
Well thats the problem alright. Your putting CFOUTPUT in the cfset tag. It's getting used as a literal. This is the better way to do this cfset variables.ImageSource = 'C:\Inetpub\wwwroot\Interspire\images_originals\#trim(catalog.sku)#.png' Alternately you could do this: cfset

Re: FileExists using variable - not working

2010-04-08 Thread Ian Skinner
On 4/8/2010 11:58 AM, Fred Grainger wrote: You said that When I build the file path from the database fields it will not work. . Lets see that code. Something may not be what it seems to be. cfset variables.ImageSource =

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
Thank you so much. What a newbie error. I had tried it without the cfoutput and was at the point of frustration I was coding recklessly. That fixed it! Well thats the problem alright. Your putting CFOUTPUT in the cfset tag. It's getting used as a literal. This is the better way to do

Re: FileExists using variable - not working

2010-04-08 Thread Fred Grainger
On 4/8/2010 11:58 AM, Fred Grainger wrote: cfset variables.ImageSource = 'C:\Inetpub\wwwroot\Interspire\images_originals\#trim(catalog.sku)#.png' The value is: C:\Inetpub\wwwroot\Interspire\images_originals\707-2298005-001.png I bet if you view source you will see that the value is