Whatever message this page gives is out now! Go check it out!

ColdFusion.Layout.enableSourceBind

Last update:
May 18, 2026

Description

If disabled, enables the source bind.

Function syntax

ColdFusion.Layout.enableSourceBind(Id)

Parameters

  • Id: Name of the layout area.

Usage

Example

ColdFusion.FileUpload.getSelectedFiles

Description

Returns an array of objects containing the filename and size of the files selected for upload. The file size is returned in bytes. The function also returns file upload status as YES|NO|Error.

Function syntax

ColdFusion.FileUpload.getSelectedFiles(Id)

Parameters

  • Id: Name of the cffileupload control.

Usage

In a real life scenario, you normally use the uploader with other controls. For example, a form with three fields: name, email, and uploader. Assume that you upload the files, but forget to click Submit or you select the files, submit the form, but forget to click Upload. You can use this function to inform the user that there are files that have been selected for upload and provide the following details:
  • FILENAME: Name of the file selected for upload.
  • SIZE: Size of the file in bytes.
  • STATUS: YES|NO|Error; YES indicates a successful upload, NO indicates that the upload is yet to occur, and Error indicates that an exception has occurred during the upload operation.

Example

The following example illustrates a scenario where the user clicks Submit and is informed about the files selected for upload:
<html> <head> <script language="javascript"> var formatNumber = function(num){ if(num < 1024) return num + " bytes"; if(num < (1024 * 1024)) return (num/1024).toFixed(2) + " KB"; if(num < (1024 * 1024 *1024)) return (num/(1024 * 1024)).toFixed(2) + " MB"; return (num/(1024 * 1024 * 1024)).toFixed(2) + " GB"; } var getSelectedList = function(id){ var files = ColdFusion.FileUpload.getSelectedFiles(id); var fileslist = ""; if(files.length) fileslist = "You have selected The following files for upload: \n\n"; for(var i=0;i < files.length; i++){ fileslist = fileslist + files[i].FILENAME + " (" + formatNumber(files[i].SIZE) + ")" if(i != files.length-1) fileslist = fileslist + "\r\n"; } if(files.length) { alert(fileslist); } } </script> </head> <body> <br> <cfform name="frmUpload" method="POST"> First Name: <cfinput type="text" name="fname" value=""><br> Last Name: <cfinput type="text" name="lname" value=""><br><br> <cffileupload url="uploadAll.cfm" name="myuploader1" hideUploadButton=false onUploadComplete="foo" /><br><br> <cfinput type="button" name="submitForm2" value="Submit" onClick="getSelectedList('myuploader1')"> </cfform> </body> </html>

See also

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page