First one, second one should throw an error.
And I would make it
<cfif left( url.dir, 2 ) IS "E:">
<cfset variables.myPath = url.dir & "/" & url.inputfile />
<cfelse>
<cfset variables.myPath = ExpandPath(url.dir) & "/" & url.inputfile
/>
</cfif>
<cffile action="write" file="#variables.myPath#" output="">
But then again its pretty dangerous allowing the path to come from the url
if this website has public access.
--
Taco Fleur
Senior Web Systems Engineer
http://www.webassociates.com
-----Original Message-----
From: Johnny Le [mailto:[EMAIL PROTECTED]
Sent: Friday, 28 January 2005 1:43 PM
To: CF-Talk
Subject: better way to code?
Which method of programming do you consider is better?
This one:
<cfif url.dir contains "E:">
<cffile action="write" file="#url.dir#/#url.inputfile#" output="">
<cfelse>
<cffile action="write" file="#ExpandPath(url.dir)#/#url.inputfile#"
output=""> </cfif>
or this one:
<cftry>
<cffile action="write" file="#url.dir#/#url.inputfile#" output="">
<cfcatch>
<cffile action="write" file="#ExpandPath(url.dir)#/#url.inputfile#"
output="">
</cfcatch>
</cftry>
I know that the first one is most people use, but the second one is more
interesting. It seems to use the power of CF more. So let me know what you
think.
Johnny
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192055
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54