Highlighted

CFFileUpload won't take onUploadComplete attribute

New Here ,
Aug 15, 2016

Copy link to clipboard

Copied

My code works fine if I don't include the onUploadComplete event handler.  But when I include it, the ccfileupload doesn't display!  Here is what my code looks like:

<cffileupload

  addbuttonlabel= "Select Files"

  align="center"

  clearbuttonlabel = "Clear"

  deletebuttonlabel = "Delete"

  extensionfilter = "mp4"

  height= "500"

  hideUploadButton = "false"

  maxfileselect = "250"

  maxuploadsize = "20000000"

  name = "File_name"

  onuploadcomplete = "finalize();"

  progressbar = "true"

  stoponerror = "true"

  title = "Select files to upload"

  uploadbuttonlabel = "Upload"

  url="upload_video.cfm"

  width = "1000"

  />

The finalize function looks like:

<script>

function finalize() {

alert('Job completed');

}

</script>

Anyone have any idea why this fails when onuploadcomplete is specified?

Dave

The attribute should just be used with the name of the function. So you need to take out the () and ;

i.e. onuploadcomplete = "finalize"

If you load up the page with a developer console you will probably see javascript errors using your code. Removing the bits above should fix it.

Views

154

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

CFFileUpload won't take onUploadComplete attribute

New Here ,
Aug 15, 2016

Copy link to clipboard

Copied

My code works fine if I don't include the onUploadComplete event handler.  But when I include it, the ccfileupload doesn't display!  Here is what my code looks like:

<cffileupload

  addbuttonlabel= "Select Files"

  align="center"

  clearbuttonlabel = "Clear"

  deletebuttonlabel = "Delete"

  extensionfilter = "mp4"

  height= "500"

  hideUploadButton = "false"

  maxfileselect = "250"

  maxuploadsize = "20000000"

  name = "File_name"

  onuploadcomplete = "finalize();"

  progressbar = "true"

  stoponerror = "true"

  title = "Select files to upload"

  uploadbuttonlabel = "Upload"

  url="upload_video.cfm"

  width = "1000"

  />

The finalize function looks like:

<script>

function finalize() {

alert('Job completed');

}

</script>

Anyone have any idea why this fails when onuploadcomplete is specified?

Dave

The attribute should just be used with the name of the function. So you need to take out the () and ;

i.e. onuploadcomplete = "finalize"

If you load up the page with a developer console you will probably see javascript errors using your code. Removing the bits above should fix it.

Views

155

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 15, 2016 0
Advocate ,
Aug 16, 2016

Copy link to clipboard

Copied

The attribute should just be used with the name of the function. So you need to take out the () and ;

i.e. onuploadcomplete = "finalize"

If you load up the page with a developer console you will probably see javascript errors using your code. Removing the bits above should fix it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 16, 2016 0
New Here ,
Aug 16, 2016

Copy link to clipboard

Copied

Many thanks for the correct answer.

Dave

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 16, 2016 0