Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
murpg #1
Getting an error with a cfile read action
I am trying to get the image width and height using <cfile> I keep getting
this error message.
An error occurred when performing a file operation READ on file
Portfolio\images\1\a.jpg.
The cause of this exception was: java.io.FileNotFoundException:
Portfolio\images\1\a.jpg (The system cannot find the path specified).
The Error Occurred in C:\CFusionMX\wwwroot\hunter\ImagesTest.cfm: line 81
79 : <tr height="110" valign="top">
80 : <td valign="top" align="center" bgcolor="##E1DCEC" width="136">
81 : <cffile action="READ" file="Portfolio\images\1\#ImageName#"
variable="JPG">
82 : <CFSET Width="#JPG#">
83 : <CFSET Height="#JPG#">
Here is my code. I want to be able to pass these variables to the popup
window so that the window will open to the exact size of the image.
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfparam name="PageNum_photocontest" default="1">
<cfquery name="photocontest" datasource="hmddb">
SELECT *
FROM Test
</cfquery>
<cfset MaxRows_photocontest=2>
<cfset
StartRow_photocontest=Min((PageNum_photocontest-1)*MaxRows_photocontest+1,Max(ph
otocontest.RecordCount,1))>
<cfset
EndRow_photocontest=Min(StartRow_photocontest+MaxR ows_photocontest-1,photocontes
t.RecordCount)>
<cfset
TotalPages_photocontest=Ceiling(photocontest.Recor dCount/MaxRows_photocontest)>
<!-- Auto Resize Window To Image Size -->
<script language="Javascript">
function PopupPic(sPicURL) {
window.open( "popup.cfm?"+sPicURL, "",
"resizable=1,HEIGHT=200,WIDTH=200");
}
</script>
<script language="javascript">
<!--
//Make graphic fit in to specified space
function makeFit(theImg, maxW, maxH){
var oldH, oldW, chngH, chngH
oldH = theImg.height;
oldW = theImg.width;
chngW = oldW/maxW;
chngH = oldH/maxH;
if(chngW > chngH) {
theImg.width = maxW;
}
else if(chngH > chngW){
theImg.height = maxH;
}
else {
theImg.width = maxW;
}
document.getElementById('thisImage').style.display = '';
}
//-->
</script>
</head>
<body>
<table width="427" align="center" bgcolor="#523F76">
<tr>
<td align="center" class="headlineSM"><a href="rules.cfm"
class="headlineSM">Complete
Rules Here</a></td>
</tr>
</table>
<table width="431" border="0" align="center" cellpadding="0" cellspcing="0">
<!--- Set default value to use in our loop --->
<cfset EndRow=0>
<!--- Set the max number of record to display per row. --->
<cfset ToDisplay=3>
<!--- Start loop and define the stop point --->
<cfloop condition="EndRow lt photocontest.RecordCount">
<!--- Set the conditions for our inner loop --->
<cfset StartRow=EndRow+1>
<cfset EndRow=EndRow+ToDisplay>
<cfif EndRow gt photocontest.RecordCount>
<cfset EndRow = photocontest.RecordCount>
</cfif>
<tr>
<cfloop query="photocontest" startrow="#StartRow#" endrow="#EndRow#">
<td valign="top"><cfoutput query="Photocontest"><form method="Post"
name="photocontest" action="vote.cfm">
<table width="136" border="0" align="center" cellpadding="2" cellspacing="0"
bgcolor="##CCCCCC">
<tr height="110" valign="top">
<td valign="top" align="center" bgcolor="##E1DCEC" width="136">
<cffile action="READ" file="Portfolio\images\1\#ImageName#" variable="JPG">
<CFSET Width="#JPG#">
<CFSET Height="#JPG#">
<a
href="javascript:PopupPic('Portfolio/images/1/#ImageName#?ID=#photocontest.ID#')
"><img src="Portfolio/images/1/#ImageName#" onLoad="makeFit(this, #width#,
#height#)" align="center" border="0" alt="Hello"></div></a></td>
</tr>
</table>
murpg Guest
-
CFFILE ACTION=READ question
Hey Gang- I have a .cfm page that reads a text file using "cffile action=read" that I parse, read, loop through, etc. When I loop through the... -
Action Script to read multiple datasets in XML doc forFlash Bar Chart
I am trying to compare groups of items using an XML source and need assistance in creating the Action Script to properly read multiple datasets... -
CFILE: How Can I restrict Upload File Size?
I am using CF 5 and would like to restrict the file size when using <CFILE Action="Upload">. Is there an easy way to do this? -
CFILE
Hey there, I had a related question to this. I am using a <input type="file"> in a form for a <cffile> on processing page and I was wondering, is... -
CALL TO ACTION: Photoshop GURU's help solve "BULGEGATE"... please read
CALL TO ACTION: Photoshop GURU's help solve "BULGEGATE"... please read Here is the story, there are 12 pictures of a wirey shape up Bush's back in... -
dempster #2
Re: Getting an error with a cfile read action
It looks like the error message tells you what the problem is:
The cause of this exception was: java.io.FileNotFoundException:
Portfolio\images\1\a.jpg (The system cannot find the path specified).
You should try modifying your CFFILE command to provide a full path name. This
might take care of it.
For example:
cffile action="READ" file="C:\Inetpub\wwwroot\Portfolio\images\1\#Image Name#"
variable="JPG">
-Paul
Paul Dempsey
Dickinson College
dempster Guest



Reply With Quote

