Question

I'm having trouble using ColdFusion 9.0.0 fileUpload() cfscript function. I'm getting this error message:

"Variable FILEUPLOAD is undefined."

Here is my code:

result = fileUpload(application.uploadPath, "attachment", "application/*, image/*", "makeUnique");

As an alternate solution, I was able to get it to work with the suggestion here Script function for file upload in ColdFusion 9 .

The fileUpload() function works on my local desktop running ColdFusion 9.0.1. I curious if anyone has gotten it to work on ColdFusion 9.0.0.

thanx

Was it helpful?

Solution

From the docs for fileUpload() (always a good place to start with these sorts of questions):

History

ColdFusion 9.0.1: Added this function.

Which kinda explains why it doesn't work in CF9.0. To "make it work" you're gonna need to roll your own, or perhaps uploadFile() on cflib might be an option.

OTHER TIPS

One other thing to maybe note with FileUpload(), is that, unlike the cffile tag-based equivalent, it doesn't give you the option to specify a "mode" (e.g. 777). So when being run on a linux servers where permissions are restricted then you can encounter some strange behaviour!

I wonder if anyone else has encountered this? or has heard of a workaround?

FileUpload() Doc: http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSd160b5fdf5100e8f36f73035129d9e70a92-8000.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top