Using CFFILE in a CFC Nightmare - coldfusion

I know this has been asked, but I cannot seem to find the solution that works.
I have a CFM page that uses the following to pass data to a CFC
<cfinvoke
component="common.cfcs.geotrails"
method="UpdateGeoTrail">
<cfinvokeargument name="title" value="#form.title#"/>
<cfinvokeargument name="Description_short" value="#form.Description_short#"/>
<cfinvokeargument name="Description" value="#form.description#"/>
<cfinvokeargument name="GTID" value="#form.gtid#"/>
<cfinvokeargument name="CatID" value="#form.catid#"/>
<cfif structKeyExists(form,"fileUpload") and len(form.fileUpload)>
<cfinvokeargument name="fileUpload" value="#form.fileUpload#"/>
</cfif>
</cfinvoke>
In the CFC that receives the data, I followed the direction at the Adobe Cookbook
<cffunction name="UpdateGeoTrail" access="public" returntype="void">
<cfargument name="title" type="string" required="yes">
<cfargument name="Description_short" type="string" required="yes">
<cfargument name="Description" type="string" required="yes">
<cfargument name="GTID" type="numeric" required="yes">
<cfargument name="CatID" type="numeric" required="yes">
<cfargument name="fileUpload" type="string" required="no">
<!--- IF THE IMAGE HAS BEEN UPLOADED --->
<!--- set the full path to the images folder --->
<cfif isdefined("arguments.fileUpload") AND len(arguments.fileUpload)>
<cfset tempmediapath = "#expandPath('/')#media/gtimages/temp/">
<cfset mediapath = "#expandPath('/')#media/gtimages/">
<cfset var cffile = "">
<cffile action="upload"
filefield="#ARGUMENTS.fileUpload#"
destination="#TempMediaPath#"
nameconflict="makeunique">
...
But I still get the dreaded error message...
"The form field /data/disk01/opt/coldfusion9/runtime/servers/coldfusion/SERVER-INF/temp/wwwroot-tmp/neotmp5003883285207133802.tmp did not contain a file."
If I follow the directions at StackExchange
( CFFILE - Uploading a file using a component )
<cffile action="upload"
filefield="fileUpload"
destination="#TempMediaPath#"
nameconflict="makeunique">
It passes without error, but a <CFDUMP> shows: [empty string].
What am I missing.
Thanks.
Phil

I know it isn't part of your cfc but did you make sure that the form has the enctype set?
<cfform action="/upload.cfm" enctype="multipart/form-data">

By removing the cffile scope, I was able to get it to work.

Related

Error when using CFHTTP

I have built an app on openBD using CFML. In the app I am using CFHTTP like following:
<cfcomponent output="false">
<cfprocessingdirective pageencoding="utf-8">
<cfset setEncoding("URL", "utf-8")>
<cffunction name="search" access="remote" returnType="any" returnFormat="plain">
<cfargument name="q" type="string" default="" required="yes">
<cfargument name="rows" type="string" default="&rows=120" required="yes">
<cfargument name="score" type="string" default="&sort=score%20desc" required="yes">
<cfargument name="highlight" type="string" default="&hl=true" required="yes">
<cfargument name="json" type="string" default="&wt=json" required="yes">
<cfargument name="phrasehighlighter" type="string" default="&hl.usePhraseHighlighter=true" required="yes">
<cfargument name="filtr" type="string" default="&fq=model:*" required="yes">
<cfargument name="callbackP" type="string" required="false">
<cfset theUrl = 'http://localhost:8090/solr/ktimatologio/select/?hl.requireFieldMatch=true&hl.fl=*&q=' & #Arguments.q# & #ARGUMENTS.rows# & #ARGUMENTS.score# & #ARGUMENTS.highlight# & #ARGUMENTS.json# & #ARGUMENTS.phrasehighlighter#>
<cfhttp url= "#theUrl#" result="rs"></cfhttp>
…………………
…………………
…………………
…………………
</cfcomponent>
When I run it I am getting the error: 'Failed to set URL: Invalid query'.
I am damn stuck! What does this error means? I think on Adobe’s CFML engine is working properly, but I am not sure. My "programing" quiver was run out of arrows!.I need to get this working on openBD.
With respect,
Tom
Greece
You should have a method argument (either GET or POST, and you should remove the port. Add the port as the port attribute to the tag, like so:
<cfset theUrl = 'http://localhost:8090/solr/ktimatologio...' />
<cfhttp method="get" url="#theURL#" port="8090" result="rs>
You'll also be better off adding all of those querystring values as cfhttpparam tags instead of appending them on your URL, like this:
<cfset theUrl = 'http://localhost/solr/ktimatologio/select/>
<cfhttp method="get" url="#theURL#" port="8090" result="rs>
<cfhttpparam type="URL" name="q" value="#Arguments.q#" />
<cfhttpparam type="URL" name="wt" value="#Arguments.JSON" />
.... more params ....
</cfhttp>
I would also highly recommend you remove the querystring name from the arguments. If you decide you want to change your implementation, you're going to be in trouble... Just accept the value you want to supply for each querystring value, but not the name of the value itself.

consuming coldfusion webservices

I am trying to build a web service. Here is my code for a simple web service which returns a string.
At the beginning i inserted some code from ben nadel
It refreshes the stubfile automatically because otherwise you get errors while passing parameters.
<cfcomponent
displayname="BaseWebService"
output = "false"
hint="This handles core web service features">
<cffunction
name="Init"
access="public"
returntype="any"
output="false"
hint="Returns an initialized web service instance.">
<cfreturn THIS />
</cffunction>
<cffunction
name="RebuildStubFile"
access="remote"
returntype="void"
output="false"
hint="Rebuilds the WSDL file at the given url.">
<cfargument name="Password" type="string" required="true" default="" />
<cfif NOT Compare(ARGUMENTS.Password, "sweetlegs!")>
<cfset CreateObject("java", "coldfusion.server.ServiceFactory"
).XmlRpcService.RefreshWebService(
GetPageContext().GetRequest().GetRequestUrl().Append("?wsdl").ToString()) />
</cfif>
<cfreturn />
</cffunction>
<cffunction
name="easyService"
access="remote"
returntype="any"
output="false">
<cfargument name="anyOutput" type="string" default="this and that" />
<cfargument name="xtype" type="string" required="yes" default="1" />
<cfif Compare(xtype, "1") EQ 0>
<cfset anyVar = "one" />
<cfelse>
<cfset anyVar = "two" />
</cfif>
<cfreturn anyVar>
</cffunction>
</cfcomponent>
Here I am trying to invoke the webservice.
<cfinvoke
webservice="https://[...]/Components/Webservice.cfc?wsdl"
method="RebuildStubFile">
<cfinvokeargument
name="Password"
value="sweetlegs!" />
</cfinvoke>
<cfinvoke
webservice="[...]/Components/Webservice.cfc?wsdl"
method="easyService"
returnVariable="anyVar" >
<cfinvokeargument
name="xtype"
value="2"
omit="true">
</cfinvoke>
<cfdump var="#anyVar#">
The first method of my web service component can be invoked but the second one always returns this error message:
coldfusion.xml.rpc.ServiceProxy$ServiceMethodNotFoundException: Web service operation easyService with parameters {xtype={2}} cannot be found.
at coldfusion.xml.rpc.ServiceProxy.invoke(ServiceProxy.java:149)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2301)
at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:454)
If i type in the url of the webservice, by adding
?method=easyService&xtype=2
it returns the right value. but this is like passing values with a GET method.
i have been searching for hours and don't know where the problem occures.
I think when using WebService call you need to specify all arguments and use omit="true" on the proper one (not on xtype).
<cfinvoke
webservice="[...]/Components/Webservice.cfc?wsdl"
method="easyService"
returnVariable="anyVar" >
<cfinvokeargument
name="anyOutput"
value=""
omit="true">
<cfinvokeargument
name="xtype"
value="2">
</cfinvoke>

calling a method within CFC Failing, but creating it as an object is working fine

Getting something really strange that I just can't work out.
I have 3 methods within a CFC (guest.cfc):
- save
- create
- update
I pass an argumentCollection to the save method.
saveGuest = objGuest.save(argumentcollection=guestStruct)
If it includes an Identier, it passes the argumentCollecion to the update method, if it doesn't then it passes the collection to the create method.
This is working fine when called from one place int the app, but when I created a new call to the save method, the create method works fine, but if an ID is passed in the update method is called I receive an error that the UPDATE variable does not exists.
But, if I change the way I call it by creating an object of the cfc, it works..
so..
saveObject = update(argumentCollection = arguments;
Does not work. Receive an error that the update variable does not exist.
saveObject = createObject("component",'guest').update(argumentCollection = arguments);
DOES work.
note that both these calls are occuring within the guest.cfc itself.
This issue doesn't occur when I pass a form struct to the save method, but does occur when I pass it a standard struct (constructed from an XML import).
Very strange.
Anyone have any ideas on what might causing this?
EDIT 24 April - Added Code for guest.cfc
<cffunction name="save" output="false" access="remote" hint="save guest">
<cfargument name="title" type="any" required="false" default="" />
<cfargument name="first_name" type="any" required="false" default="" />
<cfargument name="surname" type="any" required="false" default="" />
<cfargument name="dob" type="any" required="false" default="NULL" />
<cfargument name="partner_first_name" type="any" required="false" default="" />
<cfargument name="partner_surname" type="any" required="false" default="" />
<cfargument name="partner_dob" type="any" required="false" default="NULL" />
<cfargument name="address_1" type="any" required="false" default="" />
<cfargument name="address_2" type="any" required="false" default="" />
<cfargument name="address_3" type="any" required="false" default="" />
<cfargument name="city" type="any" required="false" default="" />
<cfargument name="state" type="any" required="false" default="" />
<cfargument name="postcode" type="any" required="false" default="" />
<cfargument name="country" type="any" required="false" default="" />
<cfargument name="phone_bh" type="any" required="false" default="" />
<cfargument name="phone_ah" type="any" required="false" default="" />
<cfargument name="phone_mob" type="any" required="false" default="" />
<cfargument name="fax" type="any" required="false" default="" />
<cfargument name="email" type="any" required="false" default="" />
<cfargument name="business" type="any" required="false" default="" />
<cfargument name="notes" type="any" required="false" default="" />
<cfargument name="referer" type="any" required="false" default="" />
<cfargument name="prospect" type="any" required="false" default="" />
<cfargument name="occasion" type="any" required="false" default="" />
<cfargument name="occasion_date" type="any" required="false" default="NULL" />
<!---pass to Create or Save--->
<cfif NOT isdefined("arguments.guest_id") OR arguments.guest_id EQ "0">
<cfset saveObject = create(argumentCollection = arguments) />
<cfelse>
<cfset saveObject = update(argumentCollection = arguments) />
</cfif>
<cfreturn saveObject>
</cffunction>
<!---CREATE--->
<cffunction name="create" output="false" access="private" returntype="struct" hint="Create a New Item">
<cfargument name="provider_id" type="any" required="false" default="#session.providerID#" />
<cfargument name="ext_ref_id" type="any" required="false" default="NULL" />
<cfargument name="tstamp" type="any" required="false" default="#session.tStamp#" />
<cfif isValid('date',arguments.occasion_date)>
<cfset iOccasionDate = createODBCDateTime(arguments.occasion_date)>
<cfelse>
<cfset iOccasionDate = "NULL">
</cfif>
<cfset returnStruct = StructNew()>
<cfquery name="insertGuest" datasource="#Application.ds#">
INSERT INTO guest (provider_id, ext_ref_id, title, first_name, surname, full_name, partner_first_name, partner_surname, partner_full_name, address_1, address_2, address_3, city, state, postcode, country, phone_bh, phone_ah, phone_mob, fax, email, company, notes, referer, prospect, occasion, occasion_date, tstamp)
VALUES (#provider_id#, #ext_ref_id#, '#arguments.title#', '#arguments.first_name#', '#arguments.surname#', '#arguments.first_name# #arguments.surname#', '#arguments.partner_first_name#', '#arguments.partner_surname#', '#arguments.partner_first_name# #arguments.partner_surname#', '#arguments.address_1#', '#arguments.address_2#', '#arguments.address_3#', '#arguments.city#', '#arguments.state#', '#arguments.postcode#', '#arguments.country#', '#arguments.phone_bh#', '#arguments.phone_ah#', '#arguments.phone_mob#', '#arguments.fax#', '#arguments.email#', '#arguments.company#', '#arguments.notes#', '#arguments.referer#', '#arguments.prospect#', '#arguments.occasion#', #iOccasionDate#, #CreateODBCDateTime(tstamp)#)
</cfquery>
<cfquery name="guest" datasource="#Application.ds#">
SELECT max(guest_id) as id
FROM guest
WHERE provider_id = #provider_id#
</cfquery>
<cfset returnStruct.id = #guest.id#>
<cfreturn returnStruct>
</cffunction>
<!---UPDATE--->
<cffunction name="update" output="false" access="private" returntype="struct" hint="Update an existing item">
<!---general details--->
<cfquery name="update" datasource="#Application.ds#">
UPDATE guest
SET provider_id = provider_id
<cfif isdefined("arguments.title")>
,title = '#arguments.title#'
</cfif>
<cfif isdefined("arguments.first_name")>
,first_name = '#arguments.first_name#'
</cfif>
<cfif isdefined("arguments.surname")>
,surname = '#arguments.surname#'
</cfif>
<cfif isdefined("arguments.full_name")>
,full_name = '#arguments.full_name#'
</cfif>
<cfif isdefined("arguments.dob")>
,dob = #formDate2odbcDate(arguments.dob)#
</cfif>
<cfif isdefined("arguments.partner_first_name")>
,partner_first_name = '#arguments.partner_first_name#'
</cfif>
<cfif isdefined("arguments.partner_surname")>
,partner_surname = '#arguments.partner_surname#'
</cfif>
<cfif isdefined("arguments.partner_full_name")>
,partner_full_name = '#arguments.partner_full_name#'
</cfif>
<cfif isdefined("arguments.partner_dob")>
,partner_dob = #formDate2odbcDate(arguments.partner_dob)#
</cfif>
<cfif isdefined("arguments.address_1")>
,address_1 = '#arguments.address_1#'
</cfif>
<cfif isdefined("arguments.address_2")>
,address_2 = '#arguments.address_2#'
</cfif>
<cfif isdefined("arguments.address_3")>
,address_3 = '#arguments.address_3#'
</cfif>
<cfif isdefined("arguments.city")>
,city = '#arguments.city#'
</cfif>
<cfif isdefined("arguments.state")>
,state = '#arguments.state#'
</cfif>
<cfif isdefined("arguments.postcode")>
,postcode = '#arguments.postcode#'
</cfif>
<cfif isdefined("arguments.country")>
,country = '#arguments.country#'
</cfif>
<cfif isdefined("arguments.phone_bh")>
,phone_bh = '#arguments.phone_bh#'
</cfif>
<cfif isdefined("arguments.phone_ah")>
,phone_ah = '#arguments.phone_ah#'
</cfif>
<cfif isdefined("arguments.phone_mob")>
,phone_mob = '#arguments.phone_mob#'
</cfif>
<cfif isdefined("arguments.fax")>
,fax = '#arguments.fax#'
</cfif>
<cfif isdefined("arguments.email")>
,email = '#arguments.email#'
</cfif>
<cfif isdefined("arguments.subscribe_email_broadcast")>
,subscribe_email_broadcast = '#arguments.subscribe_email_broadcast#'
</cfif>
<cfif isdefined("arguments.company")>
,company = '#arguments.company#'
</cfif>
<cfif isdefined("arguments.notes")>
,notes = '#arguments.notes#'
</cfif>
<cfif isdefined("arguments.prospect")>
,prospect = '#arguments.prospect#'
</cfif>
<cfif isdefined("arguments.occasion")>
,occasion = '#arguments.occasion#'
</cfif>
<cfif isdefined("arguments.occasion_date")>
,occasion_date = #formDate2odbcDate(arguments.occasion_date)#
</cfif>
WHERE guest_id = #arguments.guest_id#
</cfquery>
<cfset returnStruct = structNew()>
<cfset returnStruct.id = arguments.guest_id>
<cfreturn returnStruct>
</cffunction>
In CF, when inside a function and you write things like <cfset iOccasionDate = ... > and <cfquery name="insertGuest" ...> you are creating these in the global variables scope of that CFC/template.
You need to write either <cfset var iOccasionDate = ... > or <cfset local.iOccasionDate = ... > or <cfquery name="local.insertGuest" ...> to ensure they are created in the local variable scope for the function, and don't overwrite other variables.
Your specific problem is because you have this:
<cfquery name="update" datasource="#Application.ds#">
So you're overwriting your update function with an update query.
A few quick things to note:
The local scope works in CF9 and above. If you're in CF8 or below you need to mimic it by writing <cfset var local = StructNew() /> at the top of your function.
If you use Railo or OpenBD there are settings to change the default behaviour to always create in local scope (which avoids the need for var/local scoping), but ACF does not have this option (yet?)
Use cfqueryparam! - Simon has already mentioned this, but it's important enough to be repeated. You should always handle data based on where it will be used - to prevent intentional and accidental injection attacks - and for cfquery that means using cfqueryparam.
It's a bit hard to be more precise without samples of the CFC code and the calling code, however I'd be inclined to suggest that you check the init() of your component. Have you got an init() method, and are you calling it? For example, outline of a component definition
<cfcomponent>
<cffunction name="init" access="public">
<cfreturn this>
</cffunction>
<cffunction name="save" access="public">
<!--- logic --->
</cffunction>
<cffunction name="create" access="public">
<!--- logic --->
</cffunction>
<cffunction name="update" access="public">
<!--- logic --->
</cffunction>
</cfcomponent>
This would then be called by either of the following
<cfscript>
// This will work in CF9 upwards
objCFC = new guest(/* add any arguments you have in the init() method here */);
objCFC.update(......);
// This also works
objCFC = CreateObject('component','guest').init(/* add any arguments you have in the init() method here */);
objCFC.update(......);
</cfscript>
edit following your example
That CFC is nasty. There are various glaring issues.
You are relying on application/session scope within the CFC thus forcing it to rely on global variables. This is what an init() method is used for among other things, as you could init(datasource, provider_id, ext_ref_id, tstamp), store those in variables. scope, and thus it will no longer be vulnerable to variables being undefined outside the CFC
You are using a LOT of VARCHAR fields with NO escaping whatsoever with a cfc with remote access permitted. This is quite vulnerable to SQL injection. Mr Bobby Tables can show you why this is bad ( http://bobby-tables.com/ )
You keep using string value NULL. If you pass this through into a database within a varchar/quotes then it will be stored as 'NULL' and not as a database NULL value
All in all, the best course of action would be to rewrite this component. The code changes on anything that uses the component will be minimal to the point of having to add in an init() and maybe removing some arguments however you will find the stability of it improved and all being well this odd issue will disappear.

What's the most efficient way to redirect a user to the home page if the requested page doesn't exist?

I am using ColdFusion 9.1.
I am rebuilding a site from scratch and pointing an existing domain name to it. The site is still getting a few hits each day and I want to take advantage of that. I want to redirect those page requests to the home page, and not the error that is currently being served.
I am looking ONLY for a ColdFusion solution to move the bad request to the home page. So, if they request domain.com/BadPage.cfm?QString=XYZ, they will be moved to domain.com/.
I tried using the following method in the Application.cfc, but I couldn't get to work as described. It seemed to have no effect.
<cffunction name="OnError" access="public" returntype="void" output="true">
<cfargument name="Exception" type="any" required="true" /">
<cfargument name="EventName" type="string" required="false" default="" />
<cfif Exception>
<cflocation url="http://www.MyDomain.cfom/">
</cfif>
<!--- Return out. --->
<cfreturn />
</cffunction>
In short, what is the simplest ColdFusion means to redirect bad requests?
onError will not catch missing templates. Add an onMissingTemplate Handler to Application.cfc:
<cffunction name="onMissingTemplate" returntype="Boolean" output="false">
<cfargument name="templateName" required="true" type="String" />
<!--- Put your home page file name here --->
<cflocation url="/index.cfm" />
<cfreturn true />
</cffunction>
Use onMissingTemplate()
<cffunction name="onMissingTemplate">
<cfargument type="string" name="targetPage" required=true/>
<cflocation url="http://www.MyDomain.cfom/">
</cffunction>

CFfile -- value is not set to the queried data

I have this add user form, it also doubles as a edit user form by querying the data and setting the value="#query.xvalue#". If the user exists (eg, you're editing a user, it loads in the users data from the database. When doing this on the <cffile field it does not load in the data, then when the insert goes to insert data it overrights the database values with a blank string (If a user does not input a new file). How do I avoid this?
Code:
Form:
<br/>Digital Copy<br/>
<!--- If null, set a default if not, set the default to database default --->
<cfif len(Trim(certificationsList.cprAdultImage)) EQ 0>
<cfinput type="file" required="no" name="cprAdultImage" value="" >
<cfelse>
File Exists: <cfoutput>View File</cfoutput>
<cfinput type="file" required="no" name="cprAdultImage" value="#certificationsList.cprAdultImage#">
</cfif>
Form Processor:
<!--- Has a file been specificed? --->
<cfif not len(Trim(form.cprAdultImage)) EQ 0>
<cffile action="upload" filefield="cprAdultImage" destination="#destination#" nameConflict="makeUnique">
<cfinvokeargument name="cprAdultImage" value="#pathOfFile##cffile.serverFile#">
<cfelse>
<cfinvokeargument name="cprAdultImage" value="">
</cfif>
CFC
ARGS:
<cfargument name="cprAdultExp" required="NO">
<cfargument name="cprAdultCompany" type="string" required="no">
<cfargument name="cprAdultImage" type="string" required="no">
<cfargument name="cprAdultOnFile" type="boolean" required="no">
Query:
UPDATE mod_StudentCertifications
SET
cprAdultExp='#DateFormat(ARGUMENTS.cprAdultExp, "mm/dd/yyyy")#',
cprAdultCompany='#Trim(ARGUMENTS.cprAdultCompany)#',
cprAdultImage='#Trim(ARGUMENTS.cprAdultImage)#',
cprAdultOnFile='#Trim(ARGUMENTS.cprAdultOnFile)#'
INSERT INTO
mod_StudentCertifications(
cprAdultExp,
cprAdultcompany,
cprAdultImage,
cprAdultOnFile
<cfif not
len(Trim(form.cprAdultImage)) EQ 0>
That is actually doing the reverse of what you want. I believe what you are trying to say is:
<!--- if the length is greater than 0, assume a file was uploaded --->
<cfif len(Trim(form.cprAdultImage)) GT 0>
file is not empty. do the upload ...
<cfinvokeargument name="cprAdultImage" value="#pathOfFile##cffile.serverFile#">
<cfelse>
<cfinvokeargument name="cprAdultImage" value="">
</cfif>
Edit
As an aside, .. since all of your arguments are optional, the code feels a bit awkward.
<cfinput type="file" required="no" name="cprAdultImage" value="#certificationsList.cprAdultImage#">,
You cannot really preset the file control "value" (browser security restrictions). Since a user can upload a file in both cases, just provide an input and display the "view" link only if a previous image exists.
<cfif len(Trim(certificationsList.cprAdultImage))>
File Exists:
<cfoutput>View File</cfoutput>
</cfif>
<cfinput type="file" required="no" name="cprAdultImage">
cprAdultImage='#Trim(ARGUMENTS.cprAdultImage)#',
The UPDATE logic looks a bit off as well. If a file was not supplied, you will end up overwriting the existing image with an empty string. To avoid that, only update that field if a new file was supplied (ie non-empty)
Form processing:
<cfif len(Trim(form.cprAdultImage)) GT 0>
<cffile action="upload" filefield="cprAdultImage" destination="#destination#" nameConflict="makeUnique">
<cfinvokeargument name="cprAdultImage" value="#pathOfFile##cffile.serverFile#">
</cfif>
CFC ARGS:
<!--- if values are always used in queries, should be required=true --->
<cfargument name="cprAdultExp" required="yes">
<cfargument name="cprAdultCompany" type="string" required="yes">
<cfargument name="cprAdultOnFile" type="boolean" required="yes">
<cfargument name="cprAdultImage" type="string" default="">
Query
UPDATE mod_StudentCertifications
SET
cprAdultExp='#DateFormat(ARGUMENTS.cprAdultExp, "mm/dd/yyyy")#',
cprAdultCompany='#Trim(ARGUMENTS.cprAdultCompany)#',
<!--- only overwrite the value if a new file was supplied --->
<cfif len(trim(ARGUMENTS.cprAdultImage))>
cprAdultImage='#Trim(ARGUMENTS.cprAdultImage)#',
</cfif>
cprAdultOnFile='#Trim(ARGUMENTS.cprAdultOnFile)#'
WHERE ....
And do not forget cleanup. Remove any old files...