digitalcreationz
Programmer
good old cffile..cfmx
Here is the delimma, . I'm back with the vehicle application, recoding it towards a cfc, xml ideal in mind, but for some reason now I'm having an issue.
and it's with the infamous tag cffile.
For some reason it's adding the file name to the database as a path, where it wasn't doing it before.
That is the query I'm using .. I've also tried using the cffile.serverFileName in the cfset tags.
It's been a while so I could be mistaken, . but I thought that cffile.serverfile saved the actual file? But what it's actually saving in the database is C:/CFusionMX/runtime/servers/default/SERVER-INF/temp/ a full path, .. I can't see how or why this is happening, .. can anyone enlighten me?
Is it because I'm doing this with a cfc?, I mean that "can't" be the issue, hell how is everyone doing it?
Robby
by the way, . this is how I'm passing it from my action template.
C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\ in the addressbar isn't a working path, and I have updater 2 installed.
Here is the delimma, . I'm back with the vehicle application, recoding it towards a cfc, xml ideal in mind, but for some reason now I'm having an issue.
and it's with the infamous tag cffile.
For some reason it's adding the file name to the database as a path, where it wasn't doing it before.
Code:
<cffunction name="addVehicle" access="public" returntype="boolean" displayname="Add a Vehicle" hint="Returns a boolean value whether it processed or not.">
<!--- Verify the Image for the vehicle is present, if so rename the server variable to .serverfile --->
<cfif IsDefined("form.vImages") AND Len(form.vImages)>
<cftry><!--- C:\inetpub\mathiesonmotors\uploaded_Images\Image-full --->
<cffile action="upload" filefield="vImages" destination="C:\CFusionMX\[URL unfurl="true"]wwwroot\math\uploaded_Images\Image-full\"[/URL] nameconflict="makeunique">
<cfcatch type="all">
</cfcatch>
</cftry>
<cfset vImages = cffile.serverfile >
</cfif>
<!--- Verify the Thumbnail for the vehicle is present, if so rename the server variable to .serverfile --->
<cfif IsDefined("form.vThumb") AND Len(form.vThumb)>
<cftry><!--- C:\inetpub\mathiesonmotors\uploaded_Images\Image-thumb --->
<cffile action="upload" filefield="vThumb" destination="C:\CFusionMX\[URL unfurl="true"]wwwroot\math\uploaded_Images\Image-thumb\"[/URL] nameconflict="makeunique">
<cfcatch type="all">
</cfcatch>
</cftry>
<cfset vThumb = cffile.serverfile>
</cfif>
<cftry>
<!--- Insert into the database. Also to note the trim() so it's taking away the extra padding --->
<cfquery datasource="vehicle2.mdb">
INSERT INTO vehicle2 (vRegno, vYear, vType, vMake, vModel, vColor, vExtras,
vEngine, vImages, vThumb, vKms, vCondition, vFuel, vPrice, vOnroads, vPerweek,
vPowerW, vPowerS, vLowQ, vTrans) VALUES ('#trim(form.vRegno)#','#FORM.vYear#','#FORM.vType#','#FORM.vMake#',
'#trim(form.vModel)#','#trim(form.vColor)#','#trim(form.vExtras)#','#trim(form.vEngine)#','#trim(form.vImages)#','#trim(form.vThumb)#','#trim(form.vKms)#'
, '#FORM.vCondition#', '#FORM.vFuel#', '#trim(form.vPrice)#', '#trim(form.vOnroads)#', '#trim(form.vPerweek)#', '#FORM.vPowerW#'
, '#FORM.vPowerS#', '#FORM.vLowQ#', '#FORM.vTrans#')
</cfquery>
<cfreturn true>
<cfcatch type="any">
<cfreturn false>
</cfcatch>
</cftry>
</cffunction>
That is the query I'm using .. I've also tried using the cffile.serverFileName in the cfset tags.
It's been a while so I could be mistaken, . but I thought that cffile.serverfile saved the actual file? But what it's actually saving in the database is C:/CFusionMX/runtime/servers/default/SERVER-INF/temp/ a full path, .. I can't see how or why this is happening, .. can anyone enlighten me?
Is it because I'm doing this with a cfc?, I mean that "can't" be the issue, hell how is everyone doing it?
Robby
by the way, . this is how I'm passing it from my action template.
Code:
<!--- Set defaults for the checkboxes on the add a vehicle page.--->
<cfparam name="form.vPowerS" default="no">
<cfparam name="form.vPowerW" default="no">
<cfparam name="form.vLowQ" default="no">
<!--- Initiate the component and send all of the realevant data to "that" component --->
<cfset vehicleObj = createObject("component", "#fubar#.vehicle")>
<cfset rs=vehicleObj.addVehicle(vRegno, vYear, vType, vMake, vModel, vColor, vExtras,
vEngine, vImages, vThumb, vKms, vCondition, vFuel, vPrice, vOnroads, vPerweek,
vPowerW, vPowerS, vLowQ, vTrans)>
<cfdump var="#rs#">
C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\ in the addressbar isn't a working path, and I have updater 2 installed.