I have about 1 day of learning, until I need to be able to use Coldfusion (any detailed tutorial would be welcome).
I have 2 files (t1.cfm and progress.cfc) in ColdFusion10\cfusion\wwwroot
t1.cfm:
<CFIF IsDefined("session.STATUS")>
<cfset StructDelete(Session, "Status") />
</CFIF>
<html>
<head>
<title>progressbar</title>
<script type="text/javascript">
function startprogress(barname){
ColdFusion.ProgressBar.show(barname);
ColdFusion.ProgressBar.start(barname);
}
function onFin(){
alert('Done');
}
</script>
</head>
<body>
<cfform>
<p>
<cfinput type="button" name="starter" value="start" onclick="startprogress('du')" />
<cfprogressbar name="du" duration="10000" interval="1000" width="200" oncomplete="onFin" />
</p>
<p>
<cfinput type="button" name="starter1" value="start" onclick="startprogress('du1')" />
<cfprogressbar name="du1" bind="cfc:progress.getstatus()" interval="1000" width="200" oncomplete="onFin" />
</p>
</cfform>
</body>
</html>
progress.cfc:
component output="false"
{
remote funktion getStatus(){
str = StructNew();
str.message = "blabla";
if(NOT IsDefined("session.STATUS")){
session.STATUS = 0.1;
Sleep(200);
}else if(session.STATUS LT 0.9){
session.STATUS =session.STATUS +.1;
Sleep(200);
}else{
str.message= "Done...";
session.STATUS=1.0;
}
str.status =session.STATUS;
return str;
}
}
When I open t1.cfm it says:
The specified CFC progress could not be found.
The path to the CFC must be specified as a full path, or as a relative path from the current template, without the use of mappings.
I guess the problem is with bind="cfc:progress.getstatus()" but the tutorial I followed did the exact same thing and it worked there. What did I do wrong?
Think you've got a typo:
remote funktion getStatus(){
should be:
remote function getStatus(){
you put a K in function, rather than the C it'd need.
Related
Using ColdFusion 2018, and trying to add a progress bar on an API call.Created a cfc function to fetch this API details. For this called a "getStatus()" function through bind params. And able to load the cfprogress bar successfully. The problem is that I need to pass an en extra parameter to this getstatus function . Is it possible?
Please see the sample code I tried to load cfprogressbar
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script type="text/javascript">
function startProgress() {
ColdFusion.ProgressBar.start("mydataProgressbar");
};
function onfinish() {
alert("Done");
};
</script>
<body>
<cfif IsDefined("Session.STATUS")>
<cfscript>
StructDelete(Session,"STATUS");
</cfscript>
</cfif>
<cfset sjsondata = '{"name":"Jibin","id":"1234"}'>
<!--- For code simplicity, formatting is minimal. --->
<cfform name="kitform">
<p>To make our service better and to benefit from our special offers,
take a moment to give us your email address and send us a comment.</p>
<p>Name:
<cfinput type="text" name="name"> </p>
<p>E-mail:
<cfinput type="text" name="email"> </p>
<p>Comment:
<cftextarea name="cmnt"/></p>
<p>
<cfoutput>
<cfinput type="hidden" name="jsondata" value="#sjsondata#">
</cfoutput>
<cfinput type="button" name="bttn1" value="Send Comment"
onClick=startProgress()></p>
<!--- The progressbar control --->
<cfinput type="button" name="bttn2" value="Send Comment 2"
onClick=startProgress2()></p>
<div style="padding-left:3px" >
<cfprogressbar name="mydataProgressbar"
bind="cfc:progressbar.getstatus({jsondata})"
interval="1700"
width="200"
oncomplete="onfinish"/>
</cfform>
</body>
</html>
File progressbar.cfc
<cfcomponent name="progressbar">
<cffunction name="getstatus" access="remote">
<cfargument name="jsonData" type="string" required="false">
<cfset str = StructNew()>
<cfset str.message = "Saving Data">
<cfif NOT IsDefined("session.STATUS")>
<cfset session.STATUS = 0.1>
<cfscript>
Sleep(200);
</cfscript>
<cfelseif session.STATUS LT 0.9>
<cfset session.STATUS=session.STATUS + .1>
<cfscript>
Sleep(200);
</cfscript>
<cfelse>
<cfset str.message = "Done...">
<cfset session.STATUS="1.0">
</cfif>
<cfset str.status = session.STATUS>
<cfreturn str>
</cffunction>
</cfcomponent>
Question 1: Is there a way to pass parameter to cfprogressbar getstatus() function?
Question 2: Is there any other alternative method to implement this process in progressbar.
Hey guys i am stuck at a point .I have a situation where i need to upload the scaled image in different folder for example :- 1(small).jpg on small folder , 1(medium).jpg on medium folder and 1.jpg on uploads folder. Right now the code below is uploading all 3 images on different folders but the files are blob files.How to get the scaled image . (edited the code)
<cfset destinationDirectory = expandpath('/file_uploader/uploads')>
<cfset counter = 1>
<cfset uniqueFileName = "">
<cfset destinationFilePath = "">
<cfset smallfile = "">
<cfset mediumfile ="">
<cfset mainfile= ''>
<cfscript>
variables.validMimeTypes = {'image/jpeg': {extension: 'jpg'}
,'image/png': {extension: 'png'}
,'image/png': {extension: 'gif'}
}; </cfscript>
<cftry>
<cfset cnt= 1>
<cfset file_name = #qqfilename#>
<cfset file_size = #qqtotalfilesize#>
<!--- If a file with the same name already exists at the destination --->
<cfif fileExists(destinationDirectory & "/" & file_name)>
<!--- Loop up to 100 times to try create a unique file_name --->
<cfset destinationFilePath = destinationDirectory & "/" & counter & "_" & file_name>
<!--- Loop up to 100 times to try create a unique filename --->
<cfloop condition="counter LT 100">
<cfset destinationFilePath = destinationDirectory & "/" & counter & "_" & file_name>
<cfif fileExists(destinationFilePath)>
<cfset counter++>
<cfelse>
<cfset uniqueFileName = "IMG" & counter & "_" & file_name>
<cfbreak/>
</cfif>
</cfloop>
<!--- Filename does not already exist at the destination --->
<cfelse>
<cfset uniqueFileName = "IMG" & "_" & file_name>
<cfset destinationFilePath = destinationDirectory & "/" & file_name>
</cfif>
<cfif len(trim(uniqueFileName))>
<cfset session.cntr ++>
<cfif find("(small)",file_name) neq 0>
<cfset smallfile = file_name>
<cffile
action="upload"
destination="#UploadPath2#"
accept="#StructKeyList(variables.validMimeTypes)#"
nameconflict="#smallfile#"
>
<cfelseif find("(medium)",file_name) neq 0>
<cfset mediumfile = file_name>
<cffile
action="upload"
filefield="qqfile"
destination="#UploadPath1#"
accept="#StructKeyList(variables.validMimeTypes)#"
nameconflict="#uniqueFileName#"
>
<cfelse>
<cfset mainfile= file_name>
<cffile
action="upload"
filefield="qqfile"
destination="#destinationFilePath#"
accept="#StructKeyList(variables.validMimeTypes)#"
nameconflict="#uniqueFileName#"
>
</cfif>
<CFSET local.response['success'] = true >
<CFSET local.response['type'] = 'xhr' >
<CFSET local.response['obj'] = session.cntr >
<cfelse>
<CFSET local.response['error'] = 'Unable to move the file and create a unique file_name at the destination'>
</cfif>
<cfoutput>
#serializeJSON(local.response,true)#
</cfoutput>
<cfabort/>
<cfcatch type="any">
<cfoutput> #serializeJSON(session.cntr,true)# </cfoutput>
<cfabort/>
</cfcatch> </cftry>
below is the UI page
<!DOCTYPE html> <html> <head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- jQuery
====================================================================== -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Fine Uploader Gallery CSS file
====================================================================== -->
<link href="../file_uploader/includes/fine-uploader-gallery.css" rel="stylesheet">
<!-- Fine Uploader JS file
====================================================================== -->
<script src="../file_uploader/includes/all.fine-uploader.js"></script>
<script src="../file_uploader/includes/all.fine-uploader.min.js"></script>
<script src="../file_uploader/includes/jquery.fine-uploader.js"></script>
<script src="../file_uploader/includes/jquery.fine-uploader.min.js"></script>
<!-- Fine Uploader Gallery template
====================================================================== -->
<script type="text/template" id="qq-template-gallery">
<div class="qq-uploader-selector qq-uploader qq-gallery" qq-drop-area-text="Drop files here">
<div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar"></div>
</div>
<div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
<span class="qq-upload-drop-area-text-selector"></span>
</div>
<div class="qq-upload-button-selector qq-upload-button">
<div>Upload a file </div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list" role="region" aria-live="polite" aria-relevant="additions removals">
<li>
<span role="status" class="qq-upload-status-text-selector qq-upload-status-text"></span>
<div class="qq-progress-bar-container-selector qq-progress-bar-container">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<div class="qq-thumbnail-wrapper">
<img class="qq-thumbnail-selector" qq-max-size="120" qq-server-scale>
</div>
<button type="button" class="qq-upload-cancel-selector qq-upload-cancel">X</button>
<button type="button" class="qq-upload-retry-selector qq-upload-retry">
<span class="qq-btn qq-retry-icon" aria-label="Retry"></span>
Retry
</button>
<div class="qq-file-info">
<div class="qq-file-name">
<span class="qq-upload-file-selector qq-upload-file"></span>
<span class="qq-edit-filename-icon-selector qq-edit-filename-icon" aria-label="Edit filename"></span>
</div>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
<span class="qq-upload-size-selector qq-upload-size"></span>
<button type="button" class="qq-btn qq-upload-delete-selector qq-upload-delete">
<span class="qq-btn qq-delete-icon" aria-label="Delete"></span>
</button>
<button type="button" class="qq-btn qq-upload-pause-selector qq-upload-pause">
<span class="qq-btn qq-pause-icon" aria-label="Pause"></span>
</button>
<button type="button" class="qq-btn qq-upload-continue-selector qq-upload-continue">
<span class="qq-btn qq-continue-icon" aria-label="Continue"></span>
</button>
</div>
</li>
</ul>
<dialog class="qq-alert-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">Close</button>
</div>
</dialog>
<dialog class="qq-confirm-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">No</button>
<button type="button" class="qq-ok-button-selector">Yes</button>
</div>
</dialog>
<dialog class="qq-prompt-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<input type="text">
<div class="qq-dialog-buttons">
<button type="button" class="qq-cancel-button-selector">Cancel</button>
<button type="button" class="qq-ok-button-selector">Ok</button>
</div>
</dialog>
</div>
</script>
<title>Fine Uploader Gallery View Demo</title> </head> <body>
<!-- Fine Uploader DOM Element
====================================================================== -->
<div id="fine-uploader-gallery"></div>
<!-- Your code to create an instance of Fine Uploader and bind to the DOM/template
====================================================================== -->
<script> var posturl = "../file_uploader/upload_file.cfm"; var t= 0;
var galleryUploader = new qq.FineUploader({
element: document.getElementById("fine-uploader-gallery"),
//debug: true,
autoUpload: false,
template: 'qq-template-gallery',
request:
{
// endpoint: '../file_uploader/upload_file.cfm?id=<cfoutput>#session.cntr#</cfoutput>'
endpoint: posturl
},
thumbnails:
{
placeholders:
{
waitingPath: '../file_uploader/includes/placeholders/waiting-generic.png',
notAvailablePath: '../file_uploader/includes/placeholders/not_available-generic.png'
}
},
validation:
{
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png']
},
callbacks: {
onComplete: function(id, name, responseJSON , xhrOrXdr)
{
if (responseJSON.success)
{
t++;
alert("success"+t);
uploadSuccess: {
endpoint: "../file_uploader/upload_file.cfm?id=1"
}
}
},
onError: function(id, name, errorReason, xhrOrXdr)
{
alert(qq.format("Error on file number {} - {}. Reason: {}", id, name, errorReason));
}
},
scaling:
{
//hideScaled: true,
sizes:
[
{name: "small", maxSize: 100},
{name: "medium", maxSize: 300}
]
}
});
</script> </body> </html>
There are at least two ways to determine the scaled size of an image. One way would be to look for the appropriate prefix in the image's file name. For example, if you've instructed Fine Uploader to include the phrase "small", then you should look for the string "(small)" in the file name server-side. The same goes for any other size prefix you have specified in your scaling options.
Another option would be to look at the actual size of the files in a scaling group. Each scaled file in a group will contain a qqparentuuid request parameter pointing to the UUID of the original image/file. Once you have all of these files, you can examine their sizes to determine which one is small, medium, large, etc.
I highly suggest using the first option.
Within a form I have a button that launches a cfwindow, then presents a search screen for the user to make a selection. Once selection is made, the cfwindow closes and the selected content shows in the main page by being bound to a cfdiv. This all works fine in FF but the cfdiv doesn't show at all in IE. In IE, the cfwindow works, the select works, but then no bound page.
I have tried setting bindonload and that made no difference (and I need it to be true if there is content that is pulled in via a query when it loads). All I have been able to find so far regarding this issue is setting bindonload to false and putting the cfdiv outside of the form but that's not possible in my current design.
*4/21 update
This works as expected in FF 3.6.3 and Safari 4, but does not work in multiple IE versions. In IE, the cfwindow works, the select works, but when the window closes and it tries to load the page into the div it just spins.
This is the main page, test.cfm:
<cfajaximport tags="cfwindow, cfform, cfdiv, cftextarea, cfinput-datefield">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<cfset i = 1>
<cfform>
<table>
<cfloop from="1" to="4" index="n">
<tr>
<td class="left" style="white-space:nowrap;">
<cfoutput>#n#</cfoutput>. <cfinput type="button" value="Select #n#" name="x#n#Select#i#" onClick="ColdFusion.Window.create('x#n#Select#i#', 'Exercise Lookup', 'xSelect/xSelect2.cfm?xNameVar=x#n#S#i#&window=x#n#Select#i#&workout=workout#i#', {x:100,y:100,height:500,width:720,modal:true,closable:true,draggable:true,resizable:true,center:true,initshow:true,minheight:200,minwidth:200 })" />
<cfdiv bind="url:xSelect/x2.cfm" ID="x#n#S#i#" tagName="span" bindonload="false" />
<cfinput type="hidden" ID="x#n#s#i#" name="x#n#s#i#" value="#n#" />
</td>
</tr>
</cfloop>
</table>
</cfform>
</body>
</html>
This is the cfwindow, xSelect2.cfm:
<cfparam name="form.xSelected" default="0">
<cfoutput>
1<br />
2<br />
3<br />
4<br />
</cfoutput>
This is the page bound to the cfdiv, x2.cfm:
<cfajaximport tags="cfwindow, cfform, cfdiv, cftextarea, cfinput-datefield">
<cfparam name="url.xName" default="">
<cfparam name="url.xNameVar" default="">
<cfparam name="url.xID" default=0>
<form>
<cfoutput>
<input type="text" id="xName" name="xName" value="#url.xName#" size="27" disabled="true" />
<input type="hidden" id="xNameVar" name="xNameVar" value="#url.xNameVar#" />
<input type="hidden" id="#url.xNameVar#xID" name="#url.xNameVar#xID" value="#url.xID#" />
</cfoutput>
</form>
I am significantly stuck so any help is greatly appreciated.
AND OF COURSE IF ANYONE HAS A BETTER IDEA OF HOW TO ACHIEVE THE SAME FUNCTIONALITY PLEASE SHARE!
Thanks!
The answer was very, very simple. I got the clue from Mathijs' Weblog on whitehorsez.com (thank you!!).
Evidently IE doesn't like nested forms so all I needed to do in the end was remove the form tags from x2.cfm above. It makes that page incorrect, but when read into the cfdiv it works and posts all the correct values to the form. I finished one other rough solution using getElementById which eliminated the extra page but the problem with it was that you had to save before you could change the value if there were multiple options. Here is the new and simple x2.cfm:
<cfoutput>
<input type="text" name="xName" value="#url.xName#" size="27" disabled="true" />
<input type="hidden" name="xNameVar" value="#url.xNameVar#" />
<input type="hidden" name="#url.xNameVar#xID" value="#url.xID#" />
</cfoutput>
I have a form in ColdFusion that initially has 5 input fields for file uploading. Should the user realize they have more than 5 files to upload in the process of attaching them, I would like the form to preserve the values when it submits itself for the change in # of fields.
Using the <cfform> tag with the preservedata="yes" attribute is supposed to accomplish this - but all I'm getting is a temp value stored in the input's value on resubmit that isn't displayed in the field nor works for a submission.
edit: Thanks for the great answers everyone, you all helped and were correct. I was able to implement Adam's suggested solution. Works great! Thanks!
function changeFieldCount() // javascript function for submit on input count change
{
var count = document.forms[0].numtotal.options[document.forms[0].numtotal.selectedIndex].value;
document.forms[0].action = "me.cfm?count=" + count;
document.forms[0].submit();
}
<cfparam name="url.count" default="5">
<cfform name="dispfiles" method="post" enctype="multipart/form-data" preservedata="yes">
<!--- looping for file input fields --->
<cfloop index="counter" from="1" to="#url.count#">
<cfinput type="file" name="file#counter#" size="50" maxlength="60"><br>
</cfloop>
<br>Number of Files to Attach:
<!--- looping for # of input selection--->
<cfselect name="numtotal">
<cfloop index="cnt" from="1" to="20" step="1">
<cfoutput>
<option value="#cnt#" <cfif #cnt# eq #url.count#>selected</cfif>>
#cnt#
</option>
</cfoutput>
</cfloop>
</cfselect>
<cfinput type="button" name="op-display" value="Display" onclick="changeFieldCount()">
<cfinput type="button" name="op-upload" value="Attach Files" onclick="submitfrm(this.form)">
<cfinput type="button" name="cancel" value=" Cancel " onclick="window.close()">
</cfform>
This is what I'm getting when I view source on the resulting submission:
<input name="file1" id="file1" type="file" value=".../cfusion.war/neotmp8858718543274653167.tmp" maxlength="60" size="50" /><br>
This is by design in all browsers for security reasons. There is no way you can insert the value for a file field.
To elaborate on #SpliFF's answer, what you need to do is dynamically create more file fields with JavaScript.
Here's an example that uses jQuery to make the JavaScript a little easier. I've also used a variable to track the number of file fields displayed so that they all have a unique number appended to their names, making it possible to loop over and uniquely identify them server-side.
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
//track the current number of file fields displayed
var numUploadFields = 5;
//attach an anonymous function to the button to add more fields
$(function(){
$("#add5").click(function(){
for (var i = 0; i < 5; i++){
numUploadFields += 1;
var newHTML = "<br/><input type='file' name='upload" +
numUploadFields + "' />";
$("#someSection").append(newHTML);
}
});
});
</script>
<form method="post" action="">
<div id="someSection">
<input type="file" name="upload1" /><br/>
<input type="file" name="upload2" /><br/>
<input type="file" name="upload3" /><br/>
<input type="file" name="upload4" /><br/>
<input type="file" name="upload5" />
</div>
<input type="button" id="add5" value="Add 5 more file fields" />
</form>
Build additional file inputs using JS DOM methods. Since you aren't leaving the page this is fast and nothing is lost.
How can I get the filename of a file before I call the
<cffile action = "upload">
? I can get the filename of the temp file, but not of the actual filename. In PHP land I can use the $_FILES superglobal to get what I want - but as far as I can tell no such thing exists in ColdFusion.
I can get the filename client-side but would really want to do this server side.
Thanks
Yes this is possible. You can use this function to grab the client file name before using the cffile tag:
<cffunction name="getClientFileName" returntype="string" output="false" hint="">
<cfargument name="fieldName" required="true" type="string" hint="Name of the Form field" />
<cfset var tmpPartsArray = Form.getPartsArray() />
<cfif IsDefined("tmpPartsArray")>
<cfloop array="#tmpPartsArray#" index="local.tmpPart">
<cfif local.tmpPart.isFile() AND local.tmpPart.getName() EQ arguments.fieldName> <!--- --->
<cfreturn local.tmpPart.getFileName() />
</cfif>
</cfloop>
</cfif>
<cfreturn "" />
</cffunction>
More info here: http://www.stillnetstudios.com/get-filename-before-calling-cffile/
I'm using Railo and found the original filenames with:
GetPageContext().formScope().getUploadResource('your_file_input_form_name').getName();
maybe this works on an adobe server as well? its quite handy if you want to rename your uploaded file somehow and don't want it to get moved through two temp dirs (see Renaming Files As They Are Uploaded (how CFFILE actually works))
I don't know of a way to find out before calling cffile, but there may be a workaround.
When you call <cffile action="upload"> you can specify a result using result="variable". So, call the upload with the destination as a temp file. Your result variable is a struct which contains the member clientFile, which is the name of the file on the client's computer.
Now, you can use <cffile action="move"> to do whatever it is you need to do with the original filename.
WOW, i found a great and easy solution! with a little javascript
In this way you get the temp filename for the cffile upload and the actual file.jpg name for the database
<html>
<head>
<script type="text/javascript">
function PassFileName()
{
document.getElementById("fileName").value=document.getElementById("fileUp").value;
}
</script>
</head>
<body>
<form name="form1" method="post" enctype="multipart/form-data" >
File: <input type="file" name="fileUp" id="fileUp" size="20" onchange="PassFileName()" /> <br />
Title: <input type="text" name="Title" id="Title"><br />
<input type="hidden" id="fileName" size="20" name="fileName" />
<input type="submit" name="submit">
</form>
</body>
</html>
If you have the name attribute defined on the input control, the file name will be in the FORM scope. For example:
<cfif not structIsEmpty(form)>
<cfdump var="#form#">
<cfelse>
<html>
<head>
<title>Title</title>
</head>
<body>
<form method="POST" action="#cgi.SCRIPT_NAME#">
<input type="file" name="fileIn" />
<input type="Submit" name="formSubmit">
</form>
</body>
</html>
</cfif>
Another option might be to have client-side code populate a hidden form field with the filename, which you would then have server-side.
Ben Doom's answer is generally how I would approach it, though.
Here's how we do it. Basically, there is a file field, and a string field. JavaScript grabs the filename from the browser before the form is submitted. Obviously, you need to verify that the filename on the other end is actually present (it'll be blank if the user has JavaScript disabled, for example) and you'll need to parse the string to handle platform differences (/users/bob/file.jpg versus C:\Documents and Settings\bob\file.jpg)
<script>
function WriteClientFileName(){
$('ClientFileName').value = $('ClientFile').value;
}
</script>
<form enctype="multipart/form-data" onsubmit="WriteClientFileName();">
<input type="File" name="ClientFile" id="ClientFile">
<input type="hidden" name="ClientFileName" id="ClientFileName" value="">
<input type="submit">
</form>
Incidentally, this technique is cross-language. It'll work equally well in RoR, PHP, JSP, etc.
Edit: If a user is "wielding a fierce FireBug" what's the issue? Even if they don't have Firebug, they can still rename the file on their end and change the input. Plus, you're validating your inputs, right?
There is no way to know the file name for uploaded files before saving to the server in ColdFuson, Railo or OpenBD. I typically generate 'my' new filename using the createUUID() function in advance of saving the file.