Aug
08

File Upload with ColdFusion Flash Forms

415 comments Posted by: Laura

File Upload with cfform
At last! File upload was, in my opinion, one of the most important missing features for Flash RIAs to be taken seriously. One of the reasons we couldn’t reproduce HTML forms with Flash CFForm was the file upload. But now that the new Flash Player has file I/O features, we can use it to incorporate them to Flash forms, and make it even better than regular file upload, with more user feedback such as progress bars. As you may expect, you need the Flash Player 8 to run this example. In the zip file you will find a custom tag, an example, and a swf file.

We have implemented most of the I/O methods provided by the new API, and use them to add a progress bar and some progress information such as percentage and total bytes uploaded.

The custom tag consists of two tags, an enclosing cf_flashUpload, and an inner tag, cf_flashUploadInput.

This is the simplest example on how to use the custom tag, with default values:

<cf_flashUpload name="defaultInput" actionFile="upload.cfm">
   <cf_flashUploadInput />
</cf_flashUpload>

A more complex example would be:

<cf_flashUpload label="Picture" name="myFile2" fileTypes="*.jpg;*.png;*.gif" fileDescription="Image files" actionFile="upload.cfm">
   <cf_flashUploadInput buttonStyle="corner-radius: 0;" inputStyle="fontWeight:bold" inputWidth="80" uploadButton="true" uploadButtonLabel="Upload Label" chooseButtonLabel="Choose file" progressBar="true" progressInfo="true" />
</cf_flashUpload>

flashUpload Usage:
Attributes:

  • name: Required; Name of the text input that will contain the name of the file to upload
  • actionFile: Required; File that will handle the upload. It can include query string variables to identify this file. Example: upload.cfm?id=15
  • label: Label to put next to the control.
  • fileTypes: extensions to accept, separated by semicolons. Example: *.jpg;*.png;*.gif
  • fileDescription: Text to describe accepted files
  • maxSize: maximum file size in Kb to upload. Defaults to no limit
  • swf: name of the swf file that contains the i/o libraries. Only needed if your swf is not in the same dir as your cfform

flashUploadInput Usage:
Attributes:

  • inputWidth: with of the text input where file name is shown
  • buttonStyle: style applied to choose and upload buttons
  • uploadButton: true/false, default true. Adds an upload button. If you set it false, you must put the generated variable called “theNameOfYourInput_uploadScript” in some other button (“theNameOfYourInput” is the name assigned in the flashUpload tag name attribute)
  • progressBar: true/false default true. Adds a progress bar.
  • progressInfo: true/false default true. Adds an output area to show progress info
  • progressBarStyle: style of progress bar
  • uploadButtonLabel: label of “Upload” button
  • chooseButtonLabel: label of “File browse” button

Notes on error codes:

404: As you may know, 404 means "file not found". As such, it means that the address you are sending the upload to does not exist or it cannot be found by the web server. You will need to make sure you are pointing the "actionFile" attribute to the right place. When in doubt, try using an absolute path (ie: /myuploads/directory/upload.cfm)

500: This error could be due to many things, but it is an "Internal server error". Issues to check:
- You are uploading files larger than the allowed post size set in the CF administrator. See the setting "Maximum size of post data" in the Settings page of the CF administrator. The default I think is 100MB
- You are uploading large files and CF is running out of memory. CF has to put the whole size in memory while it gets uploaded before it saves it to disk. If you have access to the logs (the java output logs, not the regular cf logs), check for this error.

A couple of notes from the comments:

Posting additional data: handling a file upload posted by Flash is different than handling an upload posted by an html form. The first difference is that you cannot specify the name of the file input, it will always be "FileData". The second difference is that when you trigger the file upload, you are only sending the file contents and the file name, but cannot send anything else, whether it was in the form you have or not. That is, on your "form" scope in upload.cfm, you will only see those two fields. The only data you can send is what you append to the upload action file name query string (ie: upload.cfm?variable1=test), and you will get that in the URL scope of upload.cfm.

Getting data back from the upload action page: The only things you will get from the upload action page are HTTP status codes. 200 will mean the upload was successful (or that at least there was no server error). If you change the file name, make a query to retrieve anything (ie: an id), you will not be able to send that back to the calling page. You can do any of that, for example if you wanted to send an email after a file was uploaded, or resize the image you uploaded, as this is a normal cfm page, but you cannot communicate any of this to the calling page.
An update on this: If your user is running player 9.0.28, you could get information back from the upload action page. You will have to, however, change the .fla that implements the uploading. See the docs.

View live example (please be gentle with our bandwidth)
Download the source

Category: CFForm | ColdFusion |

415 Comments so far

Write yours
Joshua Dale
1. Joshua Dale wrote on August 08, 2005 at 1:23 PM
Sweet, this is the only thing keeping me from using flash forms in my site.
Steven Ross
Its about time, I was wondering if this would be possible with the new addition of I/O in player 8. Thanks for working on this! I see a patch coming for Coldfusion.

Joshua Dale
3. Joshua Dale wrote on August 08, 2005 at 7:05 PM
You would hope so until you go into livedocs and read "this bug will be fixed in the next release"

I just want them to take the size limit off of their flash forms, there is no reason it should be on there and there is no documentation saying there is.
Todd
4. Todd wrote on August 08, 2005 at 7:47 PM
Has anyone else noticed flash forms run extremely slow in flash 8? It was so bad I had to uninstall and go back to 7. :(
I haven't found the player to be slow, actually it's faster for me. Did you check different flash forms? any in particular?
Maybe you can submit a bug about this.
Joshua Dale
6. Joshua Dale wrote on August 08, 2005 at 9:06 PM
It feels faster to me also, although the upload app seemed a little slugish, but it is in beta right ;o)
Joshua Dale
7. Joshua Dale wrote on August 08, 2005 at 9:08 PM
I do have one question though, how do you create custom tags for flash forms??? Is there an article you can point me to?
Trond Ulseth
Is there a way to display the uploaded file when it is uploaded - provided it is a image file?
M. Schopman
9. M. Schopman wrote on August 09, 2005 at 7:16 AM
Is the limitation of not being to resize the browse dialog (missing resize handle in the corner) defined by the IO functionality in Flash 8? If so that is bad :)
Doug Hughes
Is there any chance this thing has a way to prevent users from uploading files over a certian size?

Thanks!
Joshua Dale
11. Joshua Dale wrote on August 09, 2005 at 9:47 AM
Yea, it is the 3rd one down. It has a max size of 200Kb.
Joshua Dale
12. Joshua Dale wrote on August 09, 2005 at 10:13 AM
Does a copy of the swf file need to be in the same folder as where the custom tag is being called?
I don't seem to be able to get it to work otherwise.
spiraldev
13. spiraldev wrote on August 09, 2005 at 10:14 AM
Where can I get flash player 8?
Joshua Dale
14. Joshua Dale wrote on August 09, 2005 at 10:17 AM
Laura
Joshua,
There is an attribute called swf in the flashUpload tag where you can tell it where your swf is located. I only used it with absolute path (ie: /blog/examples/fileUpload.swf) but I believe it should work with relative path too.
Joshua Dale
16. Joshua Dale wrote on August 09, 2005 at 3:35 PM
Yea, I noticed that right after I posted... I guess it helps to read the instructions first ;o)

Thanks for the response though.
Trond Ulseth
Joshua, when you said:

You would hope so until you go into livedocs and read &quot;this bug will be fixed in the next release&quot;

... what exactly are you talking about. Will something be &quot;taken away&quot; from us?
Joshua Dale
18. Joshua Dale wrote on August 10, 2005 at 6:45 AM
Oh no, I was just joking...

It seems whenever a bug is reported in livedocs, the developer says it will be fixed in the next release of ColdFusion.
This behavior has always bothered me, but now I am in the ColdFusion MX 7 Updater Beta program so things are looking up.
No
19. No wrote on August 10, 2005 at 3:45 PM
Good to see Flash has hit the 20th century. Congrats to all those involved in bringing a product to a level it should have been at 15 years ago. Woopy doo!
Brian Sloan
20. Brian Sloan wrote on August 11, 2005 at 7:04 AM
I posted this in the mxna comments but since this thread is more active here it is again... Any help would be greatly appreciated.

Strange problem:

I am adding data to a table using remoting and I get the following error (from handler.onStatus): &quot;Error while calling cfc: Service app.services.facade does not have a method addData that matches the name and parameters provided.&quot; However it adds the data correctly. Here is what I am doing... In the facade file I have a addData function that looks for the arguments method (string used in switch statement to determine what function to call in another cfc) and fields (structure that hold all fields passed in). Then I have an action script function that is pretty much exactly like the one in this example to call the facade function. In my cfm file, on the click event I call the as function with following code:

_global.addRecord({
gridName:myGrid,
method:'addContract'
fields:{
idn:selectBox.selectedItem.data,
number:number.text,
(etc....)
}
});

Any ideas??? Is there a problem with my fields structure? I am trying to make the facade function more dynamic by passing a structure instead of individual args... Like I said it is inserting the record correctly just throwing that error... So it is running the function or the row wouldn't be added... What causes the handler.onStatus section to execute? I am trying to returning a result to get the primary key of the added record, but it is running the cfc function and return a status instaed of the result.

Thanks,
Brian
Michael Tyler
Any way to have multiple form fields and one Upload button?
Brian Sloan
22. Brian Sloan wrote on August 11, 2005 at 8:04 AM
got it working now... error was in the variable I was returning...
Laura
Michael,
Look at the last example in the zip file, where you can trigger the upload from any other button you choose. If you want to trigger multiple uploads, just keep pasting the generated variables (theNameOfYourInput_uploadScript) in your onclick of the button of your choice.
Phil
24. Phil wrote on August 11, 2005 at 5:49 PM
Is there a way to use other input fields like &quot;My File Name&quot; and one buttom that triggers upload and submit of other form fields?
Michael Tyler
25. Michael Tyler wrote on August 12, 2005 at 10:58 AM
Laura,
I cant get a working example of having multiple file upload fields and one submit button.
Do I just add more <cf_flashUploadInput> tags?
I would like to end up with having 5 files fields and one button to do the action.
26. Mic wrote on August 12, 2005 at 11:43 AM
nm , I got it. Dang Typos always kill
me.
27. Rick wrote on August 13, 2005 at 1:54 PM
If hit choose file or browse it does not do anything
Rick,
You need the Flash Player 8 to run this example
Trond,
We made a new post showing how to show a picture after uploading it
http://www.asfusion.com/blog/entry/showing-an-image-after-upload
Maria Kang
30. Maria Kang wrote on August 14, 2005 at 12:27 AM
It is good, because i am finding the solution on upload file in cold fusion.
I am also find the solution on how to update the upload file. Do you have the solution on that?
thank you!
Joshua Dale
31. Joshua Dale wrote on August 15, 2005 at 8:27 AM
Is there any way to keep the buttons from wrapping around?
Michael
32. Michael wrote on August 15, 2005 at 10:53 AM
Is there a way to change the destination folder of the uploaded file? I can not seem to figure out what expandpath is.

Thanks.
Paulo
33. Paulo wrote on August 16, 2005 at 5:30 PM
In my application is ocurrency this error message:

Invalid content type: "application/x-www-form-urlencoded".

CFFILE action="upload" requires forms to use enctype="multipart/form-data".

how can finish this problem?

Thanks
SaeedR
34. SaeedR wrote on August 23, 2005 at 11:09 AM
From my perspective everything looks ok; I'm able to open a file browser, select the file and even upload. The progress indicator runs but I continually receive an &quot;HTTP Error number:500&quot;.

Anyone have any ideas?
steve
new to flash but I need to create a flash form to upload a image and connect it to a reference number then has another form that will let me conduct a search of the image connected to the reference numbers stored.
any help will be appreciated
also I need to see how I could stop people from printing my pictures from my swf file and xml www.theassociates.tv
thank you
Matt Gifford
Hi guys.

This is a great script, thank you so much!

I have just integrated the tag into my cfform and it's browsing for the file which is great!

Please could someone tell me if/how you can alter the buttons and input so they dont wrap? I would like to try to get them to merge into the rest of the form without looking like it's been placed on top.

Many thanks,
and keep up the great work!

Matt
Laura
Matt,
you can try specifying the width of the text input until it doesn't wrap.
<cf_flashUpload ...>
<cf_flashUploadInput inputWidth="150" />
</cf_flashUpload>
Matt Gifford
Thanks Laura! :)
NRR
Can it truly upload multiple files i.e. not multiple file inputs but the ablity to select more than one image then click upload and upload them all one after the other? An example would be great.
Laura
Michael,
To change the destination folder just write your desired absolute path in the destination attribute (without the #s). expandpath is just a shortcut to get the current directory path. I used that so that the example would work as is when downloaded.

Paulo,
You are using the regular html form with input type="file", if you are, then you need to write
<cfform enctype="multipart/form-data" ....>

SaeedR,
Your upload action page has a problem. You need to check it, It could be either not even compiling (can you even browse that file without getting errors?) or not working with the data you are sending to it. I would recommend that you make a test with a regular html file upload to see what the problem is, then when all fixed, make the change to flash forms.

NRR,
yes, that can be done. We'll make an example when we get a chance.


Pegarm
Is there a way to cause the form to submit once the upload action is completed?
Daniel Smith
42. Daniel Smith wrote on August 30, 2005 at 2:42 PM
Pegarm,

Yes, I added "_root.submitForm();" in the onComplete listener. See my example below:

<cfif attributes.progressInfo>uploadListener.onComplete = function()
{
output.text = "Upload complete";
_root.submitForm();
}
</cfif>
Matt Gifford
Hi All.

Is there any way to change the location of the action page in your script (the upload.cfm page)?

I think I may need to specify another page to run as the action page instead to get the results and extra queries that I need, but I cannot seem to be abel to find where the upload.cfm page is specified in the code.

Any help would be greatly appreciated!

Many thanks
Matt Gifford
I'm really thick! I found the action page in the form (I forgot it was there!)

Sorry! :)
Seth
45. Seth wrote on September 05, 2005 at 1:06 PM
My upload script always fails with an IO Error when upload from a network location (UNC path on windows). Is this a problem with the beta, or a security &quot;feature&quot;.
Asher Gilbert
There's a slight bug in that although the file selection dialog filters to a file type, it does permit *.* as a search term, and so any file type can be uploaded.

Also, is I cancel the file dialog but then choose to 'browse...' again, all the listeners fire twice on each event. The listeners fire as many times as you've had the browse dialog open.

This needs to be improved.

Great job though
Matt Gifford
hello.

Please can someone tell me if I can enable the upload button to be active at all times, instead of only being displayed if a file has been selected in the browse section?

many thanks
Matt Gifford
Hi.
I am sooo almost there with what I needed this form to do. Only one thing holding me back now, and I would really REALL appreciate help on this one (my job may depend on it..)

The actionfile uploads the files, and makes unique in case of duplication.
In my form, the form data is then inserted into a database to store the filename and location on server.

However, if the file was renamed using cffile, the new &quot;unique&quot; filename is not being transferred to the database, just the original filename in the input box.

Please please please does anyone now how I can change this so that if the file is renamed on the server side, the new name is sent to the database?
I tried cffile.serverfile, but as the actionfile is a separate page, I dont know how to transmit that data to the form action page that inserts data into the database.

Please please please?
Laura
Seth,
That certainly seems to be a bug.

Asher,
I haven't seen that behavior. I'll ask Nahuel if he can take a look. Regarding the *.* search, is this in Windows? I can't make the search dialog appear in Windows and it works fine in Mac.

Matt,
To enable the upload button all the time, set disabled=&quot;false&quot; in line 128 and remove lines 69 and 75.

As of now, there is no way to send data back to the calling page.
You will have to make sure the file you are uploading does not get renamed. I usually do that by sending a unique id and naming the file with it.
SaeedR
50. SaeedR wrote on September 12, 2005 at 9:29 AM
Weird ... I'm all of a sudden receiving the &quot;IO Error&quot; whenever I try to upload, too. I'm not using a network share, however. Any idea what the bug might be resulting from?

(Thanks much for the response earlier, too.)
George
I got this all working fine. But I want to send info like 5 fields to a DB. I put the fields in the form and am using the trigger by another button. But im not sure after that. I have tried to put my INPUT satement in the Upload.cfm page but that does not work. Is there a sample somewhere? As soom as I put the INPUT in the action.cfm page it doesnt upload the image or the form fields. Can anyone help? Thanks
nigel king
52. nigel king wrote on September 15, 2005 at 3:26 PM
Does file upload work, on a mac?
I have the prerequisite versions of browsers and OSX, every example i have found on the web (~8), and written myself, throws an IO error.

All work fine on WINXP IE,Netscape etc. I am however running OSX under PEARPC (poor developer, and this customer only has macs), is this my problem?
Next step tracing the network!
Nigel,
Yes, this work on mac, but only on OSX.
Make sure that the machine has the latest player( 8 ) installed
54. Steve wrote on September 18, 2005 at 9:41 AM
Here it is what's in the fla file:

// Action script...

// [Action in Frame 1]
function addListener(listener)
{
imageFile.addListener(listener);
} // End of the function
function browse(list)
{
imageFile.browse(list);
} // End of the function
function upload(path)
{
return(imageFile.upload(path));
} // End of the function
var imageFile = new flash.net.FileReference();
55. Luke Crawford wrote on September 19, 2005 at 7:37 PM
Awesome article! Thanks for showing how this is done. I've already looked in the Flash 8 developer docs for my one remaining question and I'm hoping somebody has the insight. Is there any way to create a drop target so a user can drag a file(s) from their desktop (Finder/Explorer) onto the Flash app instead of selecting the file from the browse dialog? Thanks if you can point me towards this!
Hi Luke,
Drag and drop from the desktop to the browser is something that flash does not support yet.
Matt Gifford
Hi all.

I have been having a nightmare today with the code.
It has worked fine until today when I noticed an error being generated.

If I try to upload a file over my production server, I receive a securitySandboxError message in the form.
However, if I try on my localhost server, the upload works.

Does anyone know of any discrepancies with the Flash Player that could have caused this?
I have checked the Sandbox settings on my server, and they arent even turned on, and it looks as though everything is as it should be.

Many thanks
How can you get the file to rename with a random number. it is throwing an error when i try and rename the file.
Laura
Matt,
That seems to happen when you try to upload to a domain different from where the swf is. Otherwise, I don't know what it may be causing it.

Mode,
Check this post as an example of renaming the file:
http://www.asfusion.com/blog/entry/showing-an-image-after-upload
James
60. James wrote on September 25, 2005 at 2:21 PM
I have included uploading a file into my form. How do I make it required like I can a input field?

Thanks
61. Noel wrote on September 29, 2005 at 3:16 PM
I must be an idiot, but I can not get it to work at all! (page is not even loading!)

I'm new to MX7, and have no clue what I'm doing wrong.

Does the demo file from above 'download the source' work straight out of the box, or do I need to add some extra settings? (like custom tag info).

MX7 is running on a Linux server, and I do understand that I have to CHMOD some dir's, but again.. the site (index.cfm) does not even load! (other sites do)
62. Noel wrote on September 29, 2005 at 4:00 PM
(ex)Idiot here..

I found the problem..
The 'Default CFFORM ScriptSrc Directory' in my MX7 &amp; linux setup was set wrong!

After playing with it, I got it to work..
Shivang
63. Shivang wrote on October 03, 2005 at 6:52 AM
Hi All,

This is a question that is not directly related to the upload of a file but to "Force a Download of a file". I have it working outside the flash forms but within the flash form if I have a link to a file type of (doc,ppt,zip, etc any file type). In IE 6.0 it does not show me the screen where it asks you "Do you want to open or save this file etc. etc. But instead it the browser shows an error saying "Action canceled
Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable." If I reload the page I get the Dialog box "Do you want to open or save this file". ANy idea why this is happening only in Internet Explorer and not Firefox and Netscape. Any ideas on how to force a file download from flash forms is appreciated. Thanks a lot
Jason
64. Jason wrote on October 03, 2005 at 3:34 PM
Anyone try it on fusebox app? Can't figure out what is the path.
65. Tony wrote on October 04, 2005 at 2:48 AM
I've tried it in FuseBox and can't get it to work, with a relative or an absolute path. I can include the swf using the path, but the same path won't work within the cf_flashUploadInput. weirdness
Noel
66. Noel wrote on October 04, 2005 at 8:27 AM
I'm trying to make the 'uploader' to go to the next page when uploading is done.

I have tried by adding the following in the uploadListener.onComplete = function()

<!--- start added stuff for redirect --->
getURL("http://www.domainname.com";);
<!--- end added stuf for redirect --->

The getURL does not work :-(

Anyone here who might have a hint, on how I can get this done?
Laura
James,
>How do I make it required like I can a input field?

I updated the custom tag to allow for required and message attributes (to be added to flashUploadInput inner tag). However, if they write something into the text field, it will validate even though it was not uploaded. You will have to do something fancier for that or even disable the field (but that's not included in the tag)

Shivang,
> In IE 6.0 it does not show me the screen where it asks you "Do you
> want to open or save this file etc. etc. But instead it the browser
> shows an error saying "Action canceled

I don't know, this is working for me in both browsers:
<cfformitem type="html"><a href="myfile.zip">Download zip</a></cfformitem>
You might want to check your web server.

Tony,
> I've tried it in FuseBox and can't get it to work

I can't really help you with the info you provided. Paths are the same as if you would browse the file with your browser, be it a swf, or a cfm. If it works in your browser it should work here, although absolute paths are preferred.

Noel,
> The getURL does not work

Use _root.getURL("http://www.example.com";);


Erik,
> I am unable to get it to work as I am unable to designate the
> enctype to multipart/form-data

This is not using <cfinput type="file"> therefore it does not need the form-urlenconded format. If you are using this tag, hence a flash form, it should work as is. Download the example and try to run it to see if it works for you. The other person *was* using cfinput type file in a regular html form and that is why he needed the encoding type. If you want to know how this tag works, check
http://www.asfusion.com/blog/entry/file-upload-explained-and-expanded
Jason
68. Jason wrote on October 05, 2005 at 6:31 AM
Hi Laura,
FYI, I'm using FuseBox MVC
all the files (upload.cfm ,flashUploadInput.cfm, flashUpload.cfm, fileUpload.swf) are in the /view/pages

I change the path as follow:
<cf_flashUpload actionFile="view/pages/upload.cfm">
and
<cfparam name="attributes.swf" default="view/pages/fileUpload.swf">

It shows "HTTP Error number:404"
when the progressBar done uploading

Did I miss out anything?
Mizuno
69. Mizuno wrote on October 05, 2005 at 12:29 PM
I can run the example on the site, but when I download the code and try to run it on my server nothing heppens when I press the browse button. Am I missing something here?
Laura
Jason,
If you use relative path for the actionFile, it will be relative to the location of the swf, so I think in your case it should simply be upload.cfm. I would recommend though that you use absolute paths ("/your/path") to avoid any confusion.

Mizuno,
If you have Flash Player 8, there shouldn't be a problem. I suggest that you check whether the form is able to load the fileUpload.swf file.
Mizuno
71. Mizuno wrote on October 05, 2005 at 2:11 PM
Laura:

I do have Flash Player 8...downloaded it for this purpose. I have not used an .swf with a Flash Form before so I am not sure what to look for as far as whether it is loading correctly or not. Any help is appreciated.

Thanks
Jason
72. Jason wrote on October 05, 2005 at 2:26 PM
No luck still...
I've been trying absolute and relative path for both, same error keep showing up at the end of uploading.

I tried all:
actionFile=/view/pages/upload.cfm
actionFile=view/pages/upload.cfm
actionFile=upload.cfm
actionFile=http://#cgi.HTTP_HOST#/myapp/view/pages/upload.cfm

Thanks!
Laura
Mizuno,
You can use this extension in Firefox http://livehttpheaders.mozdev.org/ or Fiddler for IE to see if the file is called and it doesn't get a 404
Laura
Jason,
I don't know what the problem is. Try using Fiddler (LiveHttpHeaders does not show the Flash form post) and see what file is calling and why it is getting a 404.
75. Erik wrote on October 08, 2005 at 9:48 AM
HI Laura, Thanks for the response.

THe problem is, I am not declaring any enctype, and it still throws that error. I too am using Fusebox but i doubt that would have anything to do with it. I will continue to fiddle with it. Best,Erik
Brett
76. Brett wrote on October 10, 2005 at 2:31 PM
I can do a CFFILE upload without any errors at all. When I use this custom tag inside a flash form, I get prompted for logon credentials every time, even though I'm trying to upload to the exact same location. Even stranger, is that no matter what credentials I use (including the local administrator account), it fails with a 401 error. Any ideas?
77. Chris Albutt wrote on October 10, 2005 at 4:48 PM
Hey guys,

Got everything working fine on my local dev environment, upload to live environment and I get a Javascript error

When I run your demo source code I get the same error -
Line: 29
Char: 1
Error 'lc_id' is undefined
Code: 0
URL: ...

Anyone shed some light on this?
Shivang Patel
78. Shivang Patel wrote on October 11, 2005 at 6:09 AM
Chris Albutt:

I had the same problem some time back when I used this example. What you need to do is in the CFAdmin "Default CFFORM ScriptSrc Directory" Make sure that the path to the scripts directory is correct. I have it deployed on WebLogic and my path was all messed up and was getting the same error lc_id not defined. If you have given a context root then It needs to be there in the path. In my case I have / as my context root so this is what my path looks like: /CFIDE/scripts/.

Hope this helps..
Daz
79. Daz wrote on October 12, 2005 at 5:57 AM
I want to upload a file as well as passing other cfform data to be written to a database.

how do i integrate the file upload element with other cf form elements.

essentially i want to upload a file an pass that files name and other form values into a database via remoting?
Laura
Chris,
I never experienced that problem but I heard it happens if the browser cannot access the cfide/scripts file. Check that you are able to browse the files in that directory.

Daz,
Check this post:
http://www.asfusion.com/blog/entry/showing-an-image-after-upload
You can have the file name in a hidden field and then send all the form items by submit or via remoting.
Steve
81. Steve wrote on October 14, 2005 at 3:26 AM
Hi,

I keep getting an IO error on larger files. By large I am talking about greater than 150mb. No slow down of upload real pattern appart from more than 64mb. I have watched the server and nothing seems off there either, the upload just seems to stop.

Help!
Steve
82. Steve wrote on October 14, 2005 at 4:08 AM
I have some more information that might help. It apears that the upload will fail at 64mb intervals. If I watch the input to the server durring an upload i can see a conanstant bytes per sec in at around 1058028. At 64mb, 128mb the upload flash will stall, maybe for a few seconds. The result is that the stream is interupted and lost. following on the flash routine will continue for a while and then error with an IO error.

So what is causing a pause every 64mb?

Coldfusion mx7 Enterprise (windows).
Firefox and IE

Thanks

Steve

Daz
83. Daz wrote on October 14, 2005 at 4:48 AM
Thanks Laura,

Is there any examples of sending via remoting as opposed to receiving, as the only posts I can see all talk about receiving.

Thanks For Your Help

Daz
Mizuno
84. Mizuno wrote on October 17, 2005 at 11:56 AM
I am able to upload files using this code...Thanks for the great code!

However, when another user (non admin) tries to upload they receive a 401 error. I have opened it up to them as far as I can and they still get the error. They can directly save to the folder, but cannot save via the upload process. They are asked to authenticate each time they try to upload a file but receive the 401 error even with proper credentials.

What I would prefer to do is to have the repository for uploaded files to reside on another server. This would allow me play around with rights a little more as far as who can write to the folders, etc. I have given an example directory structure below and under it pose some facts and questions.

SERVER1
=======
root
..level1dir1 (documents)
..level2dir1 (department)
..level3dir1 (office)

SERVER2
=======
root
..level1dir1
..level1dir2
..level1dir3 (inetpub)
..level2dir1
..level2dir2 (wwwroot)
..level3dir1
..level3dir2
..level3dir3 (intranet)
..level4dir1
..level4dir2 (documents)
..level4dir3
..level4dir4 (upload folder)

1) Upload intranet site resides on SERVER 2 in the 'upload folder'.

2) Using code 'As Is' results in file being uploaded to 'upload folder'.

3) Altering UPLOAD.CFM by changing 'destination="#expandpath(".")#"' to 'destination="#expandpath(".")#/../level4dir2"' results in files being uploaded to documents directory on SERVER 2.

Q1) How do I change this line of code to specify a location on another server as the repository for uploaded files? i.e. I want the files to be saved to SERVER 1 into folder OFFICE.

Any help will be appreciated.
Mizuno
85. Mizuno wrote on October 17, 2005 at 11:58 AM
for above post....spaces were omitted in directory structure.

SERVER1
=======
root
..level1dir1 (documents)
....level2dir1 (department)
......level3dir1 (office)

SERVER2
=======
root
..level1dir1
..level1dir2
..level1dir3 (inetpub)
....level2dir1
....level2dir2 (wwwroot)
....level3dir1
....level3dir2
....level3dir3 (intranet)
......level4dir1
......level4dir2 (documents)
......level4dir3
......level4dir4 (upload folder)
Stuart
I really like this, it's just what i've been needing. And from a design point of view I love the colours used.

Just my problem is that i'm on a co-hosted site so i don't have a cf-tag directory but i'd like to use the cfmodule. Should this be how I am referencing it:

<cfmodule template="/webs/02005/cftags/cfform_fileUpload/fileupload.cfm" name="cf_flashupload">

In this sort of way?
Stuart
Sorry, the cfmodule i wrote should have pointed to flashupload.cfm - but still i can't get it to work.
Stuart
Hi,

I managed to get it to work but i had to have my CFTAGs in the same directory as where my form was.

Anyhow, i'm on to a new problem now. I am trying to insert a query on the upload.cfm page. Should this be possible?

<cfif structkeyexists(form,"Filedata")>
<!--- upload file with whatever attributes you need, additional variables may come in url scope --->
<cffile action="UPLOAD" filefield="Filedata" destination="#expandpath(".")#" nameconflict="MAKEUNIQUE">
<cfquery name="AddImage" datasource="user020">
INSERT INTO tbl_020eventImages (eventID)
VALUES (#form.eventID#)
</cfquery>
</cfif>


Should this be possible to add the value #form.eventID#? eventID is a field which is also in the form where my cf_flashupload tag is.

Should upload.cfm be able to receive the parsed form variables?

It's saying error 500 in the progress bar after it's finished uploading. It's fine without my query. After testing it appears it can't read #form.eventID#. But should it?

Any help i'd be very grateful.

Thanks,
Jason
89. Jason wrote on October 19, 2005 at 10:58 AM
Has anybody gotten this to work inside of an applcation.cfm protected directory?

It was working fine outside of my password protected area, but when I move the code over behind a login framework, I get the log in form displayed (which I discovered through Fiddler) -- the file never gets uploaded.

I think maybe the .fla file doesn't authenticate or something maybe? I'm not sure! :o
Jason,
This is a bug from the flash player. As far as we know, it only happens in firefox. You should submit a bug to Macromedia, we have already reported it but they will be more likely to fix it if a lot of people request it.
Laura
Stuart,
It is not possible to send any form variable directly to the upload action page. Only url variables are allowed (appended to the action url). Check this example (with filename renamed) to see how to do it: http://www.asfusion.com/blog/entry/showing-an-image-after-upload

Jason,
When we first encountered the problem I tried a workaround that didn't work. For some reason, most likely the CF Updater, it is now working. Append the session variables to the action page url. Use the same example I told Stuart above. Use a hidden field: <cfinput type="hidden" name="sessionvars" value="#session.urltoken#">
and append that to the url. If you are using the custom tag it would be something like
actionFile='upload.cfm?" + myForm.sessionvars + "'

Regarding your first question about cfmodule, the syntax would be:

<cfset params = structnew()/>
<cfset params["name"] = "myPictureField" />
<cfset params["actionFile"] = '/myRoot/upload.cfm' />

<cfmodule template="/webs/02005/cftags/cfform_fileUpload/fileupload.cfm" attributeCollection="#params#">
<cfmodule template="/webs/02005/cftags/cfform_fileUpload/flashUploadInput.cfm" />
</cfmodule>

The problem is that the custom tag requires a name attribute, but that conflicts with the name attribute of cfmodule, so you need to use attributeCollection.
Jason Weible
92. Jason Weible wrote on October 24, 2005 at 12:26 PM
Hi Laura,

First, thanks for the follow up response.

I tried your suggestion, and was unable to make it work. I suspect maybe there is a version difference between my version of CF and yours. Could you tell me what yours is? The server I am hosted on is running 7,0,1,116466 which is the 6.1 updater - so I don't think there is a newer one out there.

The only other option I can think of is possibly the way my application.cfm is structured is causing the problem.

Here's how I called the tag - it successfully sent the CFTOKEN and CFID values according to Fiddler, but I still get the log in box.


<cf_flashUpload name="productImage" actionFile="uploadImage.cfm?#SESSION.urltoken#&itemID=#URL.itemID#">                  
<cf_flashUploadInput progressBarStyle="#progressBarStyle#" buttonStyle="#buttonStyle#" inputWidth="150" />
</cf_flashUpload>
Jason
93. Jason wrote on October 24, 2005 at 5:05 PM
I'm also getting this, but I'm not sure of the significance since I've never seen an error like this before.

<head><title>JRun Servlet Error</title></head>
<h1>500 Corrupt form data: premature ending</h1>
<body>Corrupt form data: premature ending</body>

Sorry for so many posts. ><
Laura
Jason,
You are not using the accept attribute of cffile, right?
Regarding the updater, I have the same version as you, but I just remembered that I also applied the cffile hotfix that was released shortly after the updater (hf70160996_cffile_upload.jar).
Once you have it working (hopefully you will), transfer the session and itemId vars to a hidden field, otherwise your form will recompile each time one of those change.
Jason
95. Jason wrote on October 24, 2005 at 9:43 PM
Negatory on the accept attribute of cffile.

I'll speak to my server host about the hot fix and see if that helps. :) Thanks for the info!

I'll also get the variables passed via hidden fields, thanks for that tip!
Nathbot
96. Nathbot wrote on October 28, 2005 at 5:08 AM
Hi everyone,

I'm using this great piece in a Fusebox application and it works. I've seen that some people have problem with it, so here how I configured it:

In my case, upload.cfm is in the same folder as the caller page. I am uploading in a folder "images" which is at the site root

actionFile = "upload.cfm"

and in my upload.cfm page:
destination="#expandpath('../images')#"

I hope it will help you guys!

-------

On another hand, I have a small question.
I'd like to update a datagrid field with the image name after having clicked "Choose file" and..well, chosen a file.
I tried to bind a text input to the img_name field, and then apply an "onChange" action to this input, but it doesn't work.
I can't seem to find where I could modify the CFtag code to launch an action after having chosen the file... Any idea?

And thanks again for your great work, which often saves my day.
Nathbot
97. Nathbot wrote on October 28, 2005 at 5:09 AM
Sorry, I realize I forgot to mention that my caller page is in a folder "Admin", also at the site root (hence the "../images" in the ExpandPath)
Nathbot
99. Nathbot wrote on October 28, 2005 at 5:51 AM
Yay!
I never thought of using the &quot;show image after upload&quot; code to do this... I got pretty blind with my eyes glued to my own code. Ouch!
Thanks a lot Todd!
Jason
100. Jason wrote on October 28, 2005 at 10:51 AM
Unfortunetely, it doesn't work for me Nathbot.
I'm glad it work for you! btw, which version of FB you using?
I'm in FB4.1 MVC
Matt
101. Matt wrote on November 10, 2005 at 2:54 AM
change your publishing settings to flash player 8.0 :-) I have just realised how stupid and easy it is :-(
Don
102. Don wrote on November 12, 2005 at 2:55 PM
I was wondering if anyone could help me on this one. I'm trying to add two upload fields in the same action but it wont load. I used two &quot;&lt;cf_flashUploadInput.. &quot; inside &lt;cf_flashUpload, and i tried other avenues but non working, im trying to be able to upload 2 files and add comments in another field, how can I do this?

Thanks guys
Don
103. Don wrote on November 12, 2005 at 3:05 PM
^^^^^^^^^^
Scrach some of that, now I just need help on adding input text fields to the flash uploader for descriptions for that image thats being uploaded...
I read all the posts and found the section for the multiple file uploads, now i need help on this one.
Noel
104. Noel wrote on November 12, 2005 at 3:35 PM
Hi all,

What wysiwyg editor/programs do you use to edit this 'cfflash' stuff?

I am using 'Dreamweaver' and 'Notepad', but they do not really work for layout stuff.
Laura
Don,
You can only send variables through url query string. Otherwise, you can submit the form to get the additional image data.

Noel,
We can't recommend you anything as we code them by hand using Eclipse or CF Studio. But you could try Flex builder and try to translate it to cfform.
Nathbot
106. Nathbot wrote on November 21, 2005 at 1:53 AM
Hi Jason,

I think I've figured out you can make this work on Fusebox (I'm using 4.1 as well).

I'm gonna try to make it simple...

First, check this line in flashUpload.cfm:

<cfparam name="attributes.swf" default="path_to_folder/fileUpload.swf">

the "path_to_folder" thing must be in the fusebox way, i.e. if your swf is in the folder "admin" which is at the root, you just put "admin/fileUpload.swf".

Then, in upload.cfm:
what I hadn't figured out before, is that the path is relative to the previous param. For instance, in my case, I upload files to a folder named "docs" which is also at the site root. So I use this destination path: #expandpath('../docs/')#

I hope this time it helps you, tell me if you still have problems!
107. Antwain wrote on November 21, 2005 at 8:02 PM
Help, I'm still getting the HTTP Error number:500. Has anybody else got this error and fixed it?
Lamonte
108. Lamonte wrote on November 22, 2005 at 12:55 PM
Works fine locally, but when I upload the files to a remote server its says that the file has been uploaded but then nothing ever shows up in the specified folder, or any folder for that matter. Can someone help me with this?
109. Anny wrote on November 23, 2005 at 4:41 AM
Can i upload file with Drag and drop mechanism?
Danny Young
Forgive me for not reading through all of these comments, but is there a way to add another input, say a text field? I have an upload function that requires the user to type in a description, which also gets put into the database.

Thanks,
Danny Young
Robert
This is probably a lower level question, but I have been able to get this working using Firefox on my shared server. However, in IE the file selection box doesn't appear, and on my local dev server when I load the index.cfm page in either FF or IE I just get a blank page. What do I need to do with Flash or CF to fix this? Note, this may also be why I get some kind of OCX (or something) error when I run a flash cfchart from my local/dev server. Thanks.
Robert
Sorry, in IE on my shared CF server the browse and choose file buttons appear, they just don't do anything when clicked on. I have Flash 8.

Thanks again.
Robert
Actually it is working in IE. There was a slight delay after clicking the choose file button and I wasn't waiting long enough before. It seems to be quicker after the dialog box comes up once.

Lamonte, look 2 posts above yours for uploading to a unique location. It works on my shared server fine.

Thanks Laura for such a great form, it's exactly what I've been looking for. I can now easily upload 5 ~6mb files at the same time with progress bars and stats!
Steff
I am looking for a possibility to select and upload multiple files. I am working with ColdFusion and found this article very interesting. The post from Posted By NRR / Posted At 8/26/05 11:25 AM seems to be exactly the thing i am looking for, but i did not found the promised example:

NRR,
yes, that can be done. We'll make an example when we get a chance.
Posted By Laura / Posted At 8/26/05 3:00 PM

Thats why i ask again if it is possible and if maybe someone does know of an example.
James - Efficinet
115. James - Efficinet wrote on November 29, 2005 at 10:05 AM
I have the same problems others have with uploading files from a network drive. If I copy the file to the local machine I can upload with no issue. If I try to upload from a network drive I get an IO Error. Has a resolution been identified that I did not see?

Thanks,

James
Eve
116. Eve wrote on November 30, 2005 at 3:11 AM
Hi All,
I'm using the script and everything works fine.

But, when I make a resetForm() the 'Browser' button doesn´t work any more...Could someone help me with this?

Thanks a lot,
Robert
I'm now getting errors, mostly HTTP 500 but also just got a HTTP 404 error. It did work fine last week, but this week it's not uploading anything. My hosting company said nothings been done to the server. Any ideas?

Thanks.
Steve
118. Steve wrote on December 02, 2005 at 4:15 AM
So I would to do is to show the contents of the directory on the fly. So as a new file is added it shows in another area without the need for re-loading the page. If i was working with a normal CFML page I would use a form and CFdirectory, the form to upload the file and the CFdirectory to show the files. This needs a re-load that I don't think I should need in the CFform-flash enviroment. Can anyone help?
Giancarlo Gomez
Ok, this is one that I just can't figure out. Everything works good, in all browsers and platforms except.... on my Mac the prgress bar and progress text does not show, even in the examples here. I know it is not the one i've customized for my app since the problem is here too. Does anyone have an idea why? Is this an issue with the flash player version for mac!

Any input would be greatly appreciated.

JC
Dan
I need to update a database with some other form information. One of the fields is a large text field, a description of the program they are uploading. Is there someway I can put in the databse without haveing to pass a potentially very long variable through the url? Also how can I change the name of the file being uploaded, I know its in your show image after upload code, but thats just to complex for me, im just a 17 year old kid, so thats a bit above my head right now. Thanks!
121. pat wrote on December 04, 2005 at 7:42 AM
will the source for the flash ever be available?
colin
122. colin wrote on December 05, 2005 at 12:38 PM
I am having some difficulty trying to assign dynamic destination paths in the upload.cfm file... any ideas ?
Don
123. Don wrote on December 11, 2005 at 12:10 PM
I have a few cf_flashUpload's on the same form &amp; there are gaps between them, is there anyway to make them closer together?
124. Kiley wrote on December 22, 2005 at 1:46 PM
very cool stuff!

I am trying to integrate the file upload tag with the address book example.

http://www.asfusion.com/blog/entry/coldfusion-flash-forms-cfdj-article

I'm afraid when you click on the browse button, nothing happens. Yet, when I have the file upload without all the other code of the address book, it works fine...???

Has anyone tried to blend the address book with the file upload tool?
Bree
Cool component. I didn't notice whether file upload status variables were available following an upload to generate a report on the transaction. If so could you publish what they are and the method to access them?

Thx!
Joey D
126. Joey D wrote on January 11, 2006 at 2:49 PM
I am having the same trouble as Kiley. I tried blending this with the address book and it does not work. Nothing happens when i click the choose file button. But if i just have the file upload outside the address book example, it works fine. Any ideas?
Joe D
127. Joe D wrote on January 11, 2006 at 2:51 PM
I am having the same trouble as Kiley. I tried blending this with the address book and it does not work. Nothing happens when i click the choose file button. But if i just have the file upload outside the address book example, it works fine. Any ideas?My code looks like this.

FIRST PAGE

<cfform name="addressBook" format="flash" height="430" width="580" timeout="300" scriptsrc="#Application.ScriptSrc#">
   <cfformgroup type="HBOX" height="420" width="570" style="horizontalGap: 2; ">
      <cfformgroup type="panel" label="TASK ORDERS">
      <cfinclude template="flashUploader.cfm">
      </cfformgroup>
   </cfformgroup>
</cfform>


FlashUploader.cfm PAGE

<cfsilent>
<cfsavecontent variable="buttonStyle">
corner-radius: 2;
borderThickness: 0;
fill-colors: #B4E055, #9FD32E;
color: #ffffff;
</cfsavecontent>
<cfsavecontent variable="progressBarStyle">
border-thickness:0;
corner-radius: 0;
    fill-colors: #ffffff, #DEEC6A;
    theme-color: #A2DA2C;
    border-color:#A2DA2C;
    color:#ffffff;
</cfsavecontent>
<cfsavecontent variable="outputStyle">
   borderStyle:none;
   disabledColor:#333333;
   backgroundAlpha:0;
</cfsavecontent>
<cfsavecontent variable="contentPanelStyle">
   panelBorderStyle:'roundCorners';
   backgroundColor:#EFF7DF;
   headerColors:#CBEC84, #B0D660;
</cfsavecontent>   
</cfsilent>


   <cfformitem type="text" style="fontWeight:bold">Trigger upload from other button</cfformitem>
   <cf_flashUpload name="myUpload" actionFile="upload.cfm">
         <cf_flashUploadInput uploadButton="false" required="true" message="File is required" />
      </cf_flashUpload>         
   
   <cfinput type="Button" name="myUploadButton" onclick="#myUpload_uploadScript#" value="Trigger Upload"/>


Any help would be greatly appriciated. Thanks
128. Liam wrote on January 19, 2006 at 9:21 AM
How do i use this, its just what i need but have no idea what to do? Someone please post here or eamil me [email protected] please!
vince
I know this is the code to attach a file then upload. I was wondering how to send a file thats already on the server to an email address via a flash form? Please help.

Thanks
Doug
130. Doug wrote on February 02, 2006 at 8:59 AM
A forum would be a great resource for collaboration. I look forward to receiving an email when you get the multiple file upload expample working. Cheers!
Dale Wilson
Got a real bummer error for you here... and I looked hard in this blog to see if it's been covered, and I can't see where it has....

I am getting a consistant HTTP Error number 407 every time I try to upload a file, both in Firefox and MSIE. I realize this error number is associated with a proxy authentication issue, the question is... how to fix it, or circumvent it?!

Most all of my users are sitting behind their own firewalls, so my app is dead in the water... oh, help! :^(

Adam D
Does anyone know what variables the flash form is sending besides filedata? I'm trying to FTP the file-to-upload to another server without the need to use CFFILE first and I need to obtain the the file name (or at least the full path to work from) on the client side to do that. Is there a way to get this information?
Doug
133. Doug wrote on February 07, 2006 at 7:38 AM
maybe loop the form.FIELDNAMES and see what shows up?
todd
i've noticed that the oncomplete attribute of this tag fires exponentially when multiple file are uploaded without reloading the page...

in other words, if i upload once, it fires once...if i upload again, it fires twice, upload again, fires three times...

any ideas? i'm dying to get this working right.
fullejo
135. fullejo wrote on February 08, 2006 at 8:58 AM
This is such a great tag... but I can't get it to work! I always get &quot;IO Error&quot;, no matter what. I've tried everything I can think of, anybody else experience this error? The file is not on a network share like some other problems I've read above... Thanks in advance fora ny help anybody can offer.
Laura
todd,
This is a known bug in our code. It happens because a listener is added every time you click browse. We fixed it in the code we used for the file explorer (plus updated the swf so that it accepts multiple file upload). I know you'll have no problem looking at that file and copying what is necessary to make it work (it is separated in its own formitem script).

All others having errors... unless you receive a 404 (file not found) which means you are pointing to the wrong upload action file or other ColdFusion error, there isn't much we can do. Being a new feature, the player has many bugs related to uploading files under authenticated domains, under https, with network shares, files with special permissions, etc. I do know some workarounds for things like handling file uploads under a password-protected area that uses CF sessions, but for other problems, I don't know how to fix them. :(
It would be interesting to see if the new player (beta) fixes some of these issues. It was reported that the new player fixed the https problem and I think that it also fixed the network share problem. Maybe you can try upgrading and see if you still have errors.
todd
thanx laura...works perfect now :)
Jamie St. Pierre
HTTP Error 500
Hello,

Does anyone know what causes HTTP Error 500 yet? I personaly can get it working great, and so can my father on two seprate internet connections, in two sepreate places etc. I use IE, he uses FireFox, and IE Beta All work fine

My father accually Pulled the file from an Exteral Drive when uploading and it works

But I have a third friend, who gets error Http 500 error. Any Ideas

Please e-mail me with a solution to this problem, and I will donate a piece of money.

[email protected]
Mike Santoro
139. Mike Santoro wrote on February 21, 2006 at 7:36 AM
Laura,

First off super kudos on this, I have used it in 2 apps I am developing so far. I have an odd problem though and I have been unable to find anything that will fix it.

The script works fine on both my dev and test servers but when I deploy it to my production server it doesn’t upload. The browse box displays, I can choose the file, but when I click the upload button nothing happens, no error or anything.

On my other servers at this point it displays the progress bar and uploads the file. I do have the asynchronous transfers functioning but I just can't figure out how to get this to work on that one server. Any help would be appreciated. Thanks
Chad
For those using fuseaction, here's how I got mine to work:

<cf_flashUpload name="defaultFile" swf="_cf_templates/myForm/fileUpload.swf" actionFile="_cf_templates/myForm/upload.cfm">
      <cf_flashUploadInput />
</cf_flashUpload>
todd
Chad:

Can you explain that a little more? Why did you have to add _cf_templates to the path?

Todd
chad
sorry, I mis-posted.

the swf is the relative path to the flash file. then the upload action file is relative path from the swf.

hope that helps.
fullejo
143. fullejo wrote on February 27, 2006 at 12:20 PM
Laura,

You mentioned that you know some workarounds for things like handling file uploads under a password-protected area that uses CF sessions... care to share? I think this may solve the problems I'm having.

Thanks in advance!
Brian Hudson
144. Brian Hudson wrote on March 03, 2006 at 12:19 PM
For anyone who is getting the error message: "HTTP Error number:500", make sure you're using an absolute path in destination="" in the upload.cfm file. I was initially using a path relative to my web root.
Laura
Mike,
Regarding the script working in some servers but not in others, I would use Fiddler or similar proxy to see what the server is responding to the upload request.

fullejo,
The answer to your question is buried in a message of mine somewhere above. Make a find for <cfinput type="hidden" name="sessionvars" value="#session.urltoken#">
You can also download my fileexplorer and see what I do there if you feel comfortable with AS (I don't use the custom tag there)
Perseverance Meadows
146. Perseverance Meadows wrote on March 05, 2006 at 10:51 PM
Can someone please help me I cant get this to work.
Stas Newdel
147. Stas Newdel wrote on March 07, 2006 at 7:31 AM
The form seems to work for me... I see the progress bar, etc after clicking upload, but I can't see where the files are ending up. I even used just a static file name with a full absolute path and the file does't seem to end up anywhere. Any tips?

Thanks!

Stas
Adam Dachis
I had the same issue when I was implementing this at work. You may not have permissions on the directory you're uploading to correctly. 755 won't do it in some cases. Try 775 and see if that works.
Stas Newdel
149. Stas Newdel wrote on March 08, 2006 at 2:38 PM
Thanks, Adam.

Actually, my issue was different. I am using Fusebox in a setting that refuses calls to anything but index.cfm so I had to work around that.

Another question - is there a way to go to page once the upload is completek? In my scenario, I need to import the uploaded data and display it in the grid.

Thanks!

Stas
Adam Dachis
Hmm...well if it was a regular ColdFusion page you could tell it to go somewhere with a cflocation tag (i.e.: <cflocation url="somepage.cfm">), but because the flash uploader is calling the upload script, I don't think it's possible to forward to another page without editing the ActionScript in the file uploader (which we don't have access to). I think someone posted something in this thread that contained the ActionScript code that makes the file uploader work. If that's the case, you could just add the getURL() function to be executed when the file upload has finished. That's just an idea, though. I certainly haven't tested it.
Alec
I tried this custom tags on my flash form. I tested out and I can see the uploaded file sucessfully uploaded but when I tried to get the uploaded file name by using #CFFILE.ServerFile#
like on CF 5, I got error:
Element SERVERFILE is undefined in CFFILE
joel
152. joel wrote on March 10, 2006 at 1:58 PM
Any update on the upload from network drive function...? This is pretty important for my app. Thanks

David
153. David wrote on March 10, 2006 at 3:47 PM
Any way to add a default value to the file name area? I'm trying to use this in combination with real estate app example and i would like a value from a column in the grid be the default value in the upload box if possible. So that when a user selects a value in the grid, the corresponding file name of the image gets placed in the file upload box.
Thanks,
David
PS - LOVE THIS SITE!!!!!! :)
Neo
154. Neo wrote on March 11, 2006 at 4:20 AM
Hi,

I have a problew, when I have :
<cfsavecontent variable="uploadScript">
....

<cfoutput>
...
uploadSwf.upload("#actionFile#?id=imag1.jpg");
..
</cfoutput>
...

<c/fsavecontent>

This one work, but when I decide to put this one inside a function like :

<cfsavecontent variable="uploadScript">
....

function callUpload() {
<cfoutput>
...
uploadSwf.upload("#actionFile#?id=imag1.jpg");
...
</cfoutput>
}

callUpload();
</cfsavecontent>


This one Not Workingh ??? Why the <cfoutput> inside a function don't work and what is the solution to make it work inside a function ??

THKS a lot...
Need Help.
Neo

Neo
Laura
joel,
I tested it with the 8.5 player and it is working. With player 8, it works with a named network drive, but not by going to my network places.

David,
You put any text you want in the input (it is just a text input).

Neo,
You have a scope problem there. I would recommend you to download the file explorer app and use the new file upload code and swf from it. The upload code is in a separate cfformitem script tag, so it is easy to find, although you will need to manually change some things there, but it looks like you know what you are doing. It uses functions and it does not contain a bug the code in the post has. I will make a custom tag with that code, I just haven't had the time to do it yet :(
Marcus
Why doesn't the upload work from with-in the application framwork and using cfabort. In the following code, if i take the cfabort out, it uploads fine, Put it back in, and the file will not be uploaded.

<cflogin>
   <cfif not isdefined("cflogin")>
      <cfinclude template="login.cfm">
      <cfabort>
   <cfelse>
      <cfinvoke component="/universal_cfc/security" method="authenticateuser" username1="#cflogin.name#" password1="#cflogin.password#" returnvariable="auth"></cfinvoke>
      <cfif auth eq true>
         <cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="admin,manager">
      </cfif>
   </cfif>
</cflogin>
Radek Gruchalski
It is really great product. But in my opinion it requires one change.
actionFile value should be assigned to some variable and not outputed directly as:

upload('#actionFile#');

This will allow to change actionFile dynamically from the AS.
Giorgos
Select and upload multiple files plus some other data using cfinputs is really what I am looking for!
Then using cfinsert add all data to my datasourse.
I am quite close using this great custom tag however both browsers either get crashed or manage to have just the data in the database and not the actual files into the destination folder. I am really confused. Is there any way to have this kind of form? or should I have in different cfforms?
159. Peter wrote on March 28, 2006 at 5:32 AM
Clicking the upload button is not opening a dialog box in my version of Opera (8.53 Windows).
160. bill wrote on March 29, 2006 at 9:32 PM
Great example. I can upload the file with no problems.
I need to save file name in the database using remoting. How to get the file name saved on the server when nameconflict=&quot;makeunique&quot;?
Thanks,
b.
David Adams
Can you do form checking with it? For example, I want to check that the user does not upload a file with spaces in it. Can this be done?

Nick
162. Nick wrote on March 31, 2006 at 12:08 PM
Great little app, but for some reason as soon as the upload is complete, the file is deleted from my cf temp directory, and it doesn't appear that anything in my actionFile is being ran.

First thing I do in my action file is check to see if a specific directory exists (abolute path), if the dir doesn't exist, cfdirectory to create the directory. But the directory isn't ever created. However if I do a standard &lt;form&gt; and point to the action page, it all works, and all of my other cf code on the action page runs.

the flash form does return an &quot;upload complete&quot; and when I check in my coldfusion-event.log I get a

03/31 15:02:48 error Corrupt form data: premature ending
java.io.IOException: Corrupt form data: premature ending error

its almost like the &quot;stop&quot; signal is being sent to the server right at the end of the upload which casues my action script not to run.

Thanks for the help
Nick
163. Nick wrote on March 31, 2006 at 12:29 PM
:Quick Edit:

in IE my action script runs, but ultimatly returns error 500, in firefox the script doesn't run at all.

digging into why it runs in one browser but not the other.
kimie (dwkr)
164. kimie (dwkr) wrote on April 02, 2006 at 1:09 PM
hi all,
for anyone using fusebox... tested with FB3...
the easiest way to make this cool stuff work is to put upload.cfm and fileUpload.swf in another folder...i mean in your web folder.
the only reason dat i can think is there's no way framework application like fusebox will allow access to a *.cfm file using absolute path

coding sample:
this in in cfform file...
<cf_flashUpload name="defaultFile" actionFile="/upload/upload.cfm" swf="/upload/fileUpload.swf" fileTypes="*.jpg;"> <cf_flashUploadInput />
</cf_flashUpload>

this is in upload.cfm file...
<cfif structkeyexists(form,"Filedata")>
<!--- upload file with whatever attributes you need, additional variables may come in url scope --->
<cffile action="UPLOAD" filefield="Filedata" destination="#expandpath('/yourApplicationName/folder')#" nameconflict="makeunique">
</cfif>

thanks to Laura
fullejo
165. fullejo wrote on April 05, 2006 at 11:44 AM
Anybody know exactly why there are problems with https? Is it really that the flash player just doesn't support it at all? That seems like a huge oversight on someone's part at Adobe/Macromedia... It's so frustrating becuase I have an application that's all cf flash forms except the file uploads, and it's really ugly and horrible UI design as a result :( The application has to be https, I've already tried convicing the client to go unsecure...

Any thoughts or info would be appreciated.
166. Nick wrote on April 06, 2006 at 8:23 AM
I changed the name=&quot;defaultFile&quot; to a custom value, and that broke the entire thing.

So I'd suggest leaving the name parameter to its default. And then on the action page be sure to reference the file as &quot;FileData&quot; (filefield=&quot;Filedata&quot;)

Can't wait to get this thing into production!
Matthew Duffey
Will this work with CF 4.5.1 SP2? I am a newbie to CF and I am trying to add this nice little piece of functionality to our website. Right now you just sit in front of your browser without any idea of how your file upload is doing.

Thanks.
Matthew Duffey
Currently for our site you must got to a page that allows you to login in (username and password). If successful it takes you to an intermediate page that tells you, you were successfull with a button to take you to the directory listing page.

The directory listing page shows the files currently in your directory and also contains the objects used to browse for and upload files (multipart form?).

I would like to add the progress indicator to this section of the website. Can this example simply be copied into the code that already exists.

Here is the code that refers to the upload objects:
<cfoutput>
<form action="uploadfile.cfm" enctype="multipart/form-data" method="post">
<input type="hidden" name="vDirectory" value="#form.vDirectory#">
<table cellpadding=0 cellspacing=0 border=0>
   <tr>
      <td><b>Upload a File:</b></td>
   </tr>
   <tr>
      <td><input type="File" name="FileName" size="38">
      <input type="Submit" value="Upload File"></td>
   </tr>
</table>
</form>
</cfoutput>
</body>
</html>

Thanks.
Laura
fullejo,
There is some information out there regarding that problem:
http://www.powersdk.com/ted/2005/11/using-flash-player-under-https-with.php
Did you try it with the newest (beta) player to see if you still have the problem? If so, I would post the bug at Adobe labs. I haven't tried it, but I would check whether or not port 443 is referenced, and if not, then I would add the port to the upload action path (upload.cfm file)

Nick,
Changing the name shouldn't be a problem. In fact, it is a requirement if you want to have several file uploads in the same form. If you see the downloaded example, all of them have a different name. And yes, you need to name your filefield as FileData. Just to clarify, FileData variable in the action page is not something we can change. Every time Flash sends an upload, it names it FileData.

Matthew,
The tag will not work because it uses Flash Forms (introduced in CF 7). You would have to go to Flash directly:
http://blog.oinam.com/archives/2005/08/flash-8-file-upload-download/

Regarding your second question... You will need to make some modifications :)
First, the tag has to be inside a &lt;cfform type=&quot;flash&quot;&gt; tag. But since your form only contains the upload field, you can replace the whole form with one of the examples in the download.
Second, you need CF 7 ;)
Mark van Beek
Hi there,

Does anybody know if apple macintosh (firefox) is causing any problems in this case. I keep getting HTTP error 500. While working on my Windows-PC everytihing works great. I've installed latest mac-OSX flash player. Very strange (and time-consuming rather). Any help is welcome

Mark
Adam D
I use it almost exclusively on a Mac in Firefox and it works perfectly. I'd be very surprised if Firefox was the cause. It works fine in Safari?
Kiley
172. Kiley wrote on April 15, 2006 at 10:53 PM
I have this almost working perfectly! These posts are very valuable.

One very quick question:

I have the file upload on a form with several fields. How can I post the form if the file field is empty?

Kiley
Kiley
173. Kiley wrote on April 15, 2006 at 10:58 PM
I have this almost working perfectly! These posts are very valuable.

One very quick question:

I have the file upload on a form with several fields. How can I post the form if the file field is empty (the visitor does not want to upload a file but does want to enter info into the other fields)?

Kiley

PS: Sorry for the double-post. I read my previous one and it wasn't clear enough.
Jeremy
174. Jeremy wrote on May 01, 2006 at 1:37 PM
I'm still a bit lost. I'm working in a app. that uses cf login against an LDAP server. When I try to run the code as is I get the progress bar to initially say 100% then immediately switches to HTTP error number:500. Working on CFR 7.0.1 on solaris, with network drives. I have opened up permissions up the tree from where I'm trying to write.
From all the comments on this post I can't tell if I have an authentication issue or a directory permissions issue? Help?
Laura
Kiley,
As long as the field is not required, you can submit the form. The tag has a "required" attribute you can use, although it is already false by default, like this (when you want it required)
<cf_flashUploadInput uploadButton="false" required="true" message="File is required" />

Jeremy,
I am sorry but I cannot help you. I would debug it using Fiddler, logging the post data to a file, or some other tool to see what's going on. If you use cflogin, check for my workaround in previous comments. It could possibly also be a Flash bug :( I would like to compile all the problems people are having and send them to Adobe, but I need the code snippets that do not work with exact steps to reproduce.
Peter
176. Peter wrote on May 07, 2006 at 5:14 AM
I have added this functionality to an existing form but if I have it in a tabbed form group then nothing happens when I click the "Choose File" button. As soon as I take it out of the tabbed form group it works fine. What am I missing here? I'd like to keep it on the tabbed page.
Adam D
177. Adam D wrote on May 08, 2006 at 12:43 PM
I'm trying to add to a session array after upload. I'm using ArrayAppend() to do this, but it keeps telling me that the element FILES (my array) is undefined in SESSION. Here's what's going on at the end of the upload script:

<cflock timeout=20 scope="Session" type="Exclusive">
      <cfset ArrayAppend(Session.files, "#finalFileNameToUseForUpload#")>
</cflock>

I don't get an error if I create the array in the upload script before the file name is appended to it. When I do that and use cfdump to view the contents of Session.files, I get an empty array. So, that leads me to believe that when the swf is running the upload script, everything is placed inside an entirely different scope. So, if anyone knows how I can actually set session variables or at least how I can access wherever it's putting the ones I am setting, I'd really appreciate it.


Thank you!!
- Adam
Laura
Peter,
I have uploads in accordions (have not tried the tabs) and they work fine. It seems to me that for some reason when you put it there, the form cannot find the swf that makes the upload. Would you use Fiddler to see whether or not the swf gets called?

Adam,
Like a regular file upload form, you receive the file in the form scope, not in the session. In addition, the field that contains the file is not called files but Filedata. Please check the zip for an example on how to deal with the actual file saving stuff. In the upload.cfm file you will see a simple <cffile action="upload"> tag, then check the CF docs for info on how to get the file name, etc.
marpsoft
179. marpsoft wrote on May 18, 2006 at 5:25 AM
Hi

First of all sorry for my english.

I have got such problem.
Very rarly file chose window doesnt show. This bug happens randomly and disappear randomly in IE, firefox, opera. Does anyone had such problem?

Thx for any sugestions.
Kieren
180. Kieren wrote on May 23, 2006 at 1:01 PM
Hi,

I'm trying to use this in conjunction to adding information to a database. For example, I'd like to store a document title, description etc. along with the file name, *and* upload the file. I believe people have done that here, but I can't get it to work. Where can I put my insert statements? I've tried in the upload file, but that gives a internal server error (500).

Thanks, Kieren
Laura
Kieren,
See my reply http://www.asfusion.com/blog/entry/file-upload-with-coldfusion-flash-forms#comment-1086
and this other in a different post:
http://www.asfusion.com/blog/entry/showing-an-image-after-upload#comment-648

The option of sending other post variables has only been added to Flash Player 9.
Joshua Scott
Laura,

Similar to my comment on the other file upload example. After I choose a file, the input field reads "undefined" instead of the file name. Then when I click upload the percentage reader does the following:

NaN% Uploaded - 3.9 MB of 0.NaN MB

What am I doing wrong?

Thanks for your help.
Julien
Hello,
Can you explain me how install this script in my website? Here is the result after uploading source on my hosting http://julsniper.freeheb.org/
Thank you very much.
Laura
Joshua,
For some reason the file is not getting properly selected. Have you tried different browsers / flash player versions? I don't really know what the problem could be.

Julien,
I don't think your host supports ColdFusion (a server-side scripting language), which is required to run this code.
Julien
Laura,
There is not html code to show the flash forms?
Laura
Julien,
No, Flash forms get automatically generated. You can use plain Flash and some other server side scripting language if you don't have ColdFusion:
http://blog.oinam.com/archives/2005/08/flash-8-file-upload-download/
Julien
Laura,
Where do I must add the script of http://blog.oinam.com/archives/2005/08/flash-8-file-upload-download/ and what script?
Greg
188. Greg wrote on May 30, 2006 at 5:02 PM
Does anyone know if it is possible to upload an entire folder rather than individual files with ColdFusion using CFForm?
Laura
Greg,
You can't upload a folder (by clicking on the folder and expecting the contents to get uploaded), but you can upload multiple files. This tag has not been updated yet to allow for that, but ASF File Explorer does it: http://www.asfusion.com/projects/fileexplorer
Jimmy
190. Jimmy wrote on June 09, 2006 at 1:52 PM
Hello,

Thanks for the wonderful example. I was wondering how I can get the name of the file that was uploaded. I would like create an auto email send to me whenever a file gets uploaded with the name of the uploaded file. How would I reference the file name?

Thanks,
Jimmy
Dave Byers
I recently installed the Flex 2.0 ColdFusion Connectivity beta on a server and I noticed that the ASFusion Flash File Uploader that I've employed on that server now seems to have a difficult time determining upload rate.

For example, I just uploaded an 8.1 MB file and the ASFusion Flash file uploader reported it being uploaded in about a half a second. (Not possible with my 512K upload bandwidth. :)

Has anyone else noticed this? Is there a fix/patch/workaround that makes it report file upload progress accurately again?
Ed
192. Ed wrote on June 16, 2006 at 11:35 AM
I get a popup login window when trying to upload a file. It is the Windows network login screen and the progress says 100% and when you add your creditials to the login screen..it gos away but there is no file. Has anyone run into this. The upload folder is wide open to everyone but I still think it is permissions but not sure where...

My CF install is I:\Cfusion... but the web root is I:\inetpub\wwwroot\phanet\....

Any ideas...I would like to use this upload rather than the HTML method...

Ed
Laura
Dave,
I haven't noticed any problem with the updater. Besides, I am pretty sure the Flash Player calculates the upload time by itself disregarding what the server does with the file.

Ed,
I don't think Flash Player supports windows authentication. Check the permissions on the upload.cfm file.
Ed
194. Ed wrote on June 16, 2006 at 12:53 PM
we do not have authentication turned on for our web site but we get the login window for the web server when we try to upload...I have loaded Fiddler and watched the packets...the wierd thing is that when fiddler is running on my PC the upload works fine..but when it is not running the upload give a 401 error....

Any ideas on this one....

Ed
Joseph Abenhaim
195. Joseph Abenhaim wrote on June 21, 2006 at 12:40 PM
Hi Laura,

I'm trying to send the selected item in the grid as a url variable but i cant seem to get it to work, any tips on how to accomplish this ? i need it in order to name the file accordingly.

Thank you!
Joseph
Brian
196. Brian wrote on June 29, 2006 at 8:25 AM
Hi, I can't seem to get your example on the website to work. I was uploading a .txt file with only a few words in it (just to test). Thoughts?

Thanks!
Aybee
197. Aybee wrote on June 29, 2006 at 10:00 PM
Hi Laura,

I am trying to upload files of up to 300MB. When the progress bar reaches around 80 percent, an IO Error occurs. What seems to be my problem here? Is the client side responsible for the error, or does the server has something to do with it? I have tried uploading files with sizes of up to 200MB without fuss.

Thanks!
Mel
198. Mel wrote on July 07, 2006 at 7:02 AM
I'm puzzled. Everything seems to work just fine. I get an "Upload Complete" message, but when I go and look for the file on the server it doesn't exist.

<cfform name="myform" width="520" format="Flash" timeout="100" >
<cfformgroup type="panel" label="With styles" style="#contentPanelStyle#" width="500">
<cf_flashUpload
   label="Flash Movie Upload"
   name="FlashFile"
   fileTypes="*.flv"
   fileDescription="Flash Video"
   actionFile="UploadFlash.cfm?ListingID=#URL.ListingID#">

<cf_flashUploadInput
   buttonStyle="corner-radius: 4;"
   inputStyle="fontWeight:bold"
   inputWidth="150"
   uploadButton="true"
   uploadButtonLabel="Upload"
   chooseButtonLabel="Choose File"
   progressBar="true"
   progressInfo="true" />

</cf_flashUpload>
</cfformgroup>
</cfform>


<cfif structkeyexists(form,"Filedata")>
<cffile
   action="upload"
   destination="#expandPath('../data/video/Flash')#"
   filefield="FileData"
   nameconflict="makeunique"
>
James Virden
199. James Virden wrote on July 11, 2006 at 4:06 PM
Thank you for creating this component--it's very useful. I struggled a little with it as well, so here's some information for anyone with the same problem. I created a page with a selection list at the top and a file upload form underneath it. What I needed to do was add the filename to the selection list when I uploaded it. Here's the code to do it:

Main Page:
<cfformitem type="script">
public function addEnclosureToList():Void
{
var newItem = {label:"", data:""};
newItem.label = enclosure.text;
newItem.data = enclosureSelect.dataProvider.length + "";
enclosureSelect.addItem(newItem);
}
</cfformitem>
<cfselect name="enclosureSelect" size="4">
</cfselect>
<cf_flashUpload name="enclosure" actionFile="myUpload.cfm" onComplete="_root.addEnclosureToList">
<cf_flashUploadInput inputWidth="200" />
</cf_flashUpload>


It was never clear that there was an onComplete attribute you could use until you dig around the code for a while. Also, remember to put "_root" in there to access functions in the main page. Or to submit the form, you would do this: onComplete="_root.submitForm".

The only problem I'm having is the multiple calls to the onComplete listener. Can you please provide more detail? I looked at the File Explorer code and didn't find it helpful. Thanks.
Guillermo
200. Guillermo wrote on July 12, 2006 at 2:14 PM
It is possible to add input=text fields in it?
I tryied but I can't get the variables nor cfdump in cffile or cfmail is allowed (error 500)
I saw the questions but no answers.
Can we see any example even for url strings?
Laura
Joseph,
Because of the way the custom tag is written (how the quotes are in the custom tag code), if you want to add any ActionScript variable, you need to have something like this as your actionFile attribute: actionFile='upload.cfm" + myGrid.selectedItem.myColumn + "&someUrlVar=" + someVariable'

Aybee,
The Flash Player officially only supports up to 100MB. Not that it won't upload more than that, but Adobe does not support it. I don't really know what makes it fail though.

Mel,
You could perhaps make it write a log file in the action page to see what it is doing and what it's receiving.

Guillermo,
See what I am replying to Joseph in this comment.
Jon Block
There seems to be one big flaw with this component. When the file is submitted to the server, its very important to those of us who write web applications that the http cookies are passed. This seems to work correctly in Internet Explorer. In Firefox, the file upload seems to not send through any cookies (CFID + CFTOKEN = a real session) so when my upload CFM file tries to fire, it thinks the user is not logged in.

Any ideas?
Jon
Laura
Jon,
That is a problem with Flash Player. I know there are over 200 comments, but that and a workaround has been discussed above :)
See my reply to Jason in #92: http://www.asfusion.com/blog/entry/file-upload-with-coldfusion-flash-forms#comment-253


Joseph,
A small correction to the code I showed: it needs one more + and a quote at the end:
actionFile='upload.cfm" + myGrid.selectedItem.myColumn + "&someUrlVar=" + someVariable +"'
Paul
204. Paul wrote on July 19, 2006 at 5:44 AM
This is a great script but I believe there is a security flaw with it..i think this has been mentioned before but there has been no following.

If a user clicks choose file, writes *.* in the file name input field and validates it by pushing the enter key , any type of files are then listed.
in other words, you can virtually upload whatever file you wish and not only jpg.

I use this script for my personal needs, so no worries here, but I thought it would good to share this finding with people using it on a production server, where visitors can upload files. It could become problematic.
Paul
205. Paul wrote on July 19, 2006 at 5:53 AM
Or you could just rename the extension of any file to jpg and still manage to upload it.
Adam
206. Adam wrote on July 19, 2006 at 6:52 AM
It's only a security risk if you choose to make it one. You don't have to allow people to upload any file type. Are you suggesting to include a parameter that allows you to choose file types you don't want to let people upload rather than only setting the types you want to allow? That would be a good feature, but it still doesn't get around the file extension renaming problem you brought up. Of course, it could check the content header (not sure if this can even be done locally, but if it can it's probably not that easy) but then the user could just insert a false content header. That's harder than renaming it, obviously, but if they know how to bring down a server they probably know how to do that.

As far as I know, there isn't really a good way to check on the client-side for malicious/bad files. Building this stuff in probably wouldn't help with actual security that much. There would need to be some serious server-side checking to ensure the file didn't contain malicious code, unless there's a simple way of doing this that I don't know about. Please tell me if there is :).


- Adam
Paul
207. Paul wrote on July 19, 2006 at 6:15 PM
Hello Adam,

The filtering file type feature is available in this script , but as I said you could bypass it by doing *.* submission or rename for example .exe file to jpg

<cf_flashUpload label="Picture" name="myFile2" fileTypes="*.jpg;*.png;*.gif" >
As you can see filetypes allowed are specified.

I didn't really look at the mechanisms to block malicious uploads, as I use this script for personal use.

However, here is a suggestion I would probably follow if I had to block unwanted files. This idea only apply for images
filtering.

Lets assume, the file has been uploaded.Just after upload I would test the width and height of the file uploaded..If it is indeed a picture, then you would get positive values, if not, a negative value would be returned ( generally -1)

So you test either the width or the height value or both, if a negative value is thrown, you trigger the cffile delete function.

Just an idea, there could be better solutions available.
Todd
What am I missing here? Why not just use the accept attribute of cffile? Who cares if someone can hack around the front end as long as you can reject it on the server...

From Adobe documentation regarding "accept":

Limits the MIME types to accept. Comma-delimited list. For example, to permit JPEG and Microsoft Word file uploads:

accept = "image/jpg, application/msword"

The browser uses file extension to determine file type.
Paul
209. Paul wrote on July 19, 2006 at 8:34 PM
I don't know for you Todd, but the accept attribute for the cffile upload does not work in this script.
I think, it might be ignored as flash is used instead.
Did you make it working at your end ?

In a typical html form, the accept attribute works well.
Fred
210. Fred wrote on August 08, 2006 at 1:26 PM
Great app but does not seem to write the file to the destination. Am I missing something?
yydoo
211. yydoo wrote on August 11, 2006 at 12:24 AM
Hi guys.

This is a great script, thank you so much!

I want my uploaded file automatic to be process like rename the file or trigger other cfm file. How am i possible to do that ?? Teach me please...

Thank you very much...
DarkLight
Did anyone find a way to use these form with files > 64 Mb?
Greg
Is there a way to have my upload.cfm page send output.text back to the form?
I want to update the text where it says "Upload Complete." while I am extracting zip files, then change it as it resizes and stores the image.
Laura
Greg,
You can't send anything back. But you don't need to. Use the onComplete attribute of the flashUploadInput tag to run a custom function when the upload is complete. In that function you can change the contents of any control. Also, if you do all that (extract, resize, etc) in the upload.cfm file, the upload will not "finish" until that page finishes its execution, so the Upload Complete label will not appear until that happens anyway.
Kristin
215. Kristin wrote on September 19, 2006 at 11:03 AM
Hello all!
I've downloaded this code (and the upload image code and the upload explained code), and was able to combine them all into the type of form that I want. Thank you for putting all this out here!!!

I have two last questions, though.
1. Is it possible to have a "Remove" button next to each text field in case a user browses and selects something he didn't want? I've tried clearing the text field, but that doesn't actually delete the data. Does it have to do with getting rid of FileData somehow? I have to admit I didn't really understand what was happening in the flashUpload.cfm file.

and 2. Is there a way to keep it from submitting to the action page until all of files are uploaded (I have five uploads in one form)? I currently have _root.submitForm() in the uploadListener.onComplete function, but then the form submits as soon as the quickest file is uploaded, while some of the larger ones are still going. It works great if they're all small files, but there could be ppts along with a text file. I could have only one upload field in the form, and make them resubmit the form over and over, but I didn't want to make the user do that.

Thanks again for posting so much great stuff!
Laura
Kristin,
I don't think you can do that by using this custom tag. You will have to customize it to be able to do what you want.
This post explains what it going on a little better:
http://www.asfusion.com/blog/entry/file-upload-explained-and-expanded
If you see, when the user clicks the upload button (or we otherwise trigger the upload), we call this function: uploadSwf.upload("upload.cfm"); and that makes the actual upload. You will have to check whether the user has "removed" the file to upload and if that is the case do not call upload() and skip that file.

Regarding your second question, again, you will have to do some record keeping. You can get called when each file is uploaded (by using onComplete) and then when you know that all the files have been uploaded, only then submit the form.
Eric
217. Eric wrote on September 24, 2006 at 6:07 PM
Hi,
I just want an email notification when a file is uploaded. I have tried adding a cfmail tag to the upload.cfm page after the cffile tag, before the closing cfif tag, but no email is received. Any ideas? Thank you!
Eric
218. Eric wrote on September 24, 2006 at 6:18 PM
Hi,

Never mind my previous comment, it worked, the email was just delayed. Thanks for a great app!
George Smith
I have everything working, but as I can see a few posts have mentioned that when in a framework or combined app the Browse button does not work. Mine works but only when the app is fisrt loaded. I have 7 file uploads 25 check boxs and 10 fields. They work fine the first time but when I press a button onClick="resetForm()" the browse buttons do not work anymore. Anyone know whats going on and can help me? Thanks
Mark Kruger
A customer of ours is using this tool and is getting the error "corrupt form data: premature end" ... Anyone have any tips?
Jason
221. Jason wrote on October 05, 2006 at 2:56 PM
Is there a good set of instructions on how to use this. I can't find where to set the name, how to submit the form to another script to process the submitted file (in this case a picture) with a cfx tag, how to dump the file to a specific directory, etc. It looks great and is exactly what I need but I can't figure out how to set all of the paramaters.

HELP!

Thanks.
Bannai Umai
222. Bannai Umai wrote on October 05, 2006 at 6:13 PM
WIll you post the .fla

I demand it become so.
Laura
Mark,
I am guessing from your last post in your blog that you found the answer... otherwise I don't know what the problem could be :(

Jason,
I know it is a little complex as the file upload does not behave as the normal html file upload. Maybe these posts (and comments) can help you:
http://www.asfusion.com/blog/entry/file-upload-explained-and-expanded
http://www.asfusion.com/blog/entry/showing-an-image-after-upload

The rule of thumb is that you first need to upload the files, process them in the upload.cfm page(or whatever your upload action page is), and then submit the form with the other information.


Bannai,
See this comment: http://www.asfusion.com/blog/entry/showing-an-image-after-upload#comment-639
Gregory
Hi!
One of the sulutions to select at once and upload multiple files or all files within folder is Flash upload control. It works in all browsers and OSs and just needs Flash player on client side.
See example here

http://www.element-it.com/DEMOMULTIPOW.ASPX
David
Ok, I am new to flash forms. It had a functionality to it that I liked. However, I cna't believe that they didn't provide for file uploading (cfinput type="file"). Argh! Ok, I just had to get that out. My big problem now is that I found this, (cf_flashUpload), and got it working beautifully on my local machine. Now I'm trying to get it to work on my hosting site, (HostMySite). The file I specify doesn't seem to upload, but continues over the "upload" file and when I call the supposed uploaded file in order to rename it is when I get an error. ("The value of the attribute source, which is currently "c:\absolutepath\originalfilename.pdf", is invalid.") One thing that HostMySite made me do was change the name of the tags to a unique name (cf_123flashUpload), but that still works fine on my local machine. I am wondering if it could be a permissions thing or something else. Could someone please help me?
Growler
226. Growler wrote on October 18, 2006 at 3:54 PM
I have my page setup nicely using this form, its a pity the clients using it are not the most computer literate people in the world.

Is there anyway i can have the file automatically upload once they have selected it? as opposed to having to click upload?

I know its simple to just click on upload, but its the simple things that people sometimes stuff up. Too many times am i getting phone calls saying they are getting an error "cant find *.*" when they submit the form, all because they didnt click upload......

:( save me from these nubs! please!

Thanks heaps, G
MArcio Amorim
Hi Good day my name is Marcio lives in Brazil and is Programmer using the Coldfusion language.

I read an article which voce had necessity to recoup the name of the archive that was made upload using CFFORM FILE UPLOAD http://www.asfusion.com/blog/entry/file-upload-with-coldfusion-flash-forms

You found as to receive #file.ServerFile#


Atenciosamente
Marcio dos Santos Amorim
CEREBRUM - Websites e Softwares para Internet
http://www.cerebrum.com.br/
telefax: 55 (11) 6205.3350 - celular: 55 (11) 9603.3874
msn: [email protected] - skype: atendimento_cerebrum
DJ
228. DJ wrote on November 15, 2006 at 9:18 AM
Wonderful tool! I have it working to perfection on our development server yet when I move the same files to the production server, the form appears but the choose file button does not function. Is there an obvious reason (software/patch/etc.) for this not to work? Both machines are patched for windows and CF.

Thanks for the help!

DJ
Maggie
229. Maggie wrote on November 28, 2006 at 10:10 PM
Please help! Has anyone figured out why the resetForm() function renders the "Choose File" button inoperable? Pretty Please....
Todd
230. Todd wrote on December 01, 2006 at 7:48 AM
This form work great on my development server which uses the standalone cold fusion web server, but on my production box which uses IIS 6.0, cold fusion 7.02, and active directory for authentication I am having some problems. When I try to upload a file on the production box I am able to select a file and begin the upload. The status works and shows the file being uploaded up to 100%. Once it reaches 100% I am asked to login again to active directory. The file is never uploaded and if I try to close the browser (IE7 and Firefox) both freeze.

I can get a file upload to work using (this one works):
<cfif isdefined("form.upload_now")>

<cffile action="upload" filefield="ul_path" destination= "uploadspot" nameconflict="makeunique" variable="FileName">
<cfdump var="form">
</cfoutput>
</cfif>



<cfform method="post" name="upload_form" enctype="multipart/form-data" id="upload_form">
<br>
File Name: <cfinput type="text" name="FileName" id="FileName" size="150" width="100" required="yes">
<br>
<cfinput type="file" name="ul_path" id="ul_path">
<br>
<cfinput type="submit" name="upload_now" value="submit">
</cfform>


I am guessing this is a security issue but I am not sure where to look (IIS or Cold fusion)

Thanks in advance
Maggie
231. Maggie wrote on December 06, 2006 at 11:37 AM
Laura, I just wanted to say THANK YOU - I had the issue with FireFox mentioned above, with regard to files not uploading when being behind an application.cfm file. I went to download the CFFILE hotfix at http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=f97044e&pss=rss , then proceeded to add the <cfinput type="hidden" name="sessionvars" value="#session.urltoken#"> to the cfform, and then used actionFile='upload.cfm?" +formName.sessionvars + "' l in the cf_flashUpload tag.

Doing the above enabled the files to be uploaded in FireFox!! I cannot thank you enough for the information on the site. The only thing that is really confusing me at this point is why, when using the resetForm() function, the "choose file" button does not work properly after that function has been called. Any ideas on why this might be?
Wender
232. Wender wrote on December 06, 2006 at 3:24 PM
:'(
How can i apply to this code the multiple file selection!!!!????
I'm trying to learn based on fileexport examplo but isn't working!!!!
somebody help me please!!!!
Jon
I wish that this was an open source project.
Rod
234. Rod wrote on December 15, 2006 at 8:32 AM
Ok Getting the 404 error issue... here's the scenario.

I have a fuse box application. Multiple tab navigation flash form. the code i am using is strait forward.

<cfformitem type="text" style="fontWeight:bold">upload</cfformitem>
<cf_flashUpload name="defaultFile" actionFile="user/upload.cfm" swf="user/fileUpload.swf">
<cf_flashUploadInput />
</cf_flashUpload>

The uploader brings up the dialog box and locates the file fine, but when submitted I get the 404 error. I have read every post on this issue and tried every option I can think of.

1. Placing the upload.cfm file in the root directory of the fuseapp next to the index file.
2. placing the upload file in the parsed directory (just thought i would try.
3. using /user/upload.cfm
4. using user/upload.cfm
5. upload.cfm

I even took the full example folder that i downloaded from you and tried it as it was (that worked fine) so i know it is not your issue, but i am not getting it to find the upload file.

Any help would be greatly appreciated!
Rod
235. Rod wrote on December 15, 2006 at 9:50 AM
OK, First of all let me apologize for the double post i hit refresh and it did the post again.

Second, I thought i had tried every idea but that was not true... here is what i did to get it working (sort of)

I have all the files in the user directory of my fuseapp and it fires completely fine until the upload where i get the 404.

so i just moved the upload.cfm file to the root directory next to the index.cfm file. Now it fires completely fine no 404 error but no file uploaded either.

So that is where I am now I get no file uploaded but it shows it is working correctly. I am developing this on my local machine and have no permissions issues since if I copy all the files from the zip as I downloaded it from you works completely fine but i am afraid i am having issues with this working in a fuseapp Please help.
Ed
236. Ed wrote on December 15, 2006 at 3:13 PM
I was wondering if there is a way to redirect to another page after upload of the file? I want to do some image resizing after the file is uploading and was wondering where to put my code...
Dimitris.C.
237. Dimitris.C. wrote on December 20, 2006 at 2:35 AM
Hi,

Firstly, thanks for the excellent tag you offer for free.

I couldn't find any documentation on how we can change the WHITE color that the flash form leaves in the background.

Is there a way I can change this color?

Cheers.
Dennis
I was wondering if you might offer a CF5 version of the tags or at least a detailed attribute list for the flash object that could be used to write one.
Laura
Wender,
You are right, the file explorer alows for multiple file upload. But the trick is that it uses a different swf we compiled with that functionality. I've been trying to find time to create a custom tag that includes that...

Ed,
You can use the oncomplete attribute of the custom tag (see the documentation in the source) and use getURL() to do the redirect. For what you want to do, however, you don't need to redirect. Do the resizing in the same upload.cfm page where the file upload is posted.

Dennis,
Doing this same thing in CF 5 is not possible because Flash Forms only appeared in CF 7.
You can see an example using plain Flash in the link I have in this comment: http://www.asfusion.com/blog/entry/file-upload-with-coldfusion-flash-forms#comment-892
Laura
Jon,
This *is* an open source project... The complete source is available for download.
Rod
241. Rod wrote on January 08, 2007 at 11:54 AM
OK, Here is an update for any who are trying to get this working in a fusebox application...
I was able to get everything working properly (or so it appeared) but i was not getting any file uploaded.
The reason for this is that the cf_flashUpload does not actually check to see what happens after it sends it off to the upload page it just checks to see if the page doesn't send errors.
The problem is that a fusebox app does not let you send to pages outside of the app so when you tell it to go to the upload.cfm page it send you to the index.cfm page by default.
To cf_flashUpload this appears to be working becuase it gets no errors so it says it was processed properly but you never actually hit the upload.cfm page.
To resolve this you must write an exception into your Application.cfm page to allow the upload.cfm page to fire outside of the fusebox app. It looks something like this..
<cfif findnocase("upload.cfm",cgi.SCRIPT_NAME) >
<cfapplication name="appname" sessionmanagement="Yes" clientmanagement="Yes">


Hope this helps anyone who might have had the same issues as me.
Rod
242. Rod wrote on January 09, 2007 at 2:10 PM
Laura,

Thank you so much for this script it is making my project so good. I have one question. I am now trying to create a delete button so i can clear the data from the database and delete the file form the server. I would like it to do this similar to the upload in the fact that i don't want it to leave the page just call the coldfusion script in the background like the upload.cfm is called. Is there an easy way to do this? Any help or resources to look at would be greatly appreciated.
Laura
Rod,
I would recommend you to look at Remoting (maybe this article http://www.adobe.com/devnet/coldfusion/articles/flashforms_pt2.html or see how I did that in the File Explorer http://www.asfusion.com/projects/fileexplorer/ )
Rod
244. Rod wrote on January 10, 2007 at 11:41 AM
Laura and Company,

Once again, you guys rock!! from your examples and help it works perfectly. Thank You, Thank You, Thank You.

Now I have one really strange question that you might know of how to fix. My form is quite long and I can't break it up into smaller chunks like tabs or accordions. :( Since my form is so long, my alerts show up "after the fold", so in order to see them you have to scroll to find them. Is there any way to control where or how they show up? I have the same problem with the loading scroller, it shows in the middle as well so people don't see it while loading.

If you could help me figure that one out you would be second in my book to the almighty. Any Ideas?
GiuliaN
245. GiuliaN wrote on January 24, 2007 at 3:51 PM
Hello,

I am trying to find a way to make image multiple upload
using forms in coldfusion. I have some code but as I try it, it does not seem to work for multiple files. What do I have to do to make it work?

<cfif isDefined("form.imagesNumber")>
<cfset numba=form.imagesNumber>
<cfelse>
<cfset numba=1>
</cfif>
<cfoutput>#numba#</cfoutput>

<cfif not isDefined("form.submit")>
   <form action="somefile.cfm" method="post" enctype="multipart/form-data">
   <cfoutput>   
      <cfloop from="1" to="#numba#" index="i" step="1">
      File #i#:
      <input type="file" name="file#i#" id="file#i#" /><br />
      </cfloop>
      </cfoutput>
      <input type="submit" value="PROCESS IMAGE" />
   </form>
<cfelse>
   <cfset myfilepath="#request.somepath#">
   <cfloop from="1" to="#numba#" index="i" step="1">
   <cfoutput>
   <cfif len(evaluate("form.file"&i)) GT 1>
   <cffile action="upload"
    filefield="form.file#i#"
       destination="#myfilepath#"
       nameconflict="MakeUnique">
   <cfset uploadedImage = "#cffile.serverfile#">
    </cfif>
    </cfoutput>   
   </cfloop>


Thank you!
GiuliaN
Richard
Hi All,

I have been trying to get this integrated into an exsisting form. What do I want:


I have a form with two text fields and one textarea.
I also want to have a 'upload file' field in the form itself.

In my old form (a <cfform> form)I post into a new page and executing the upload on this page aswell as the insert into the SQL database.

This example above only explains how to create a flash component to upload a file. I want the users to click one submit button and if the 'upload a file' input field is filled, then the form fields must be inserted into the database and the file must be uploaded.

Does anybody have an example for this?

Thanks,
RIchard.
Pete
247. Pete wrote on January 31, 2007 at 11:31 AM
Just wanted to say this script is awesome!! Thank you so much!!
Jason
248. Jason wrote on February 09, 2007 at 6:13 AM
I was ecstatic to hear that this component existed after put 'all my eggs in one basket' with a Flash form. Unfortunately, I am experiencing a similar problem as several people. After I click 'upload', the progress bar builds and it says Xkb of Xkb uploaded but then returns HTTP 500. I'm new to ColdFusion and my ActionScript experience is limited to basic functionality. Any help is much appreciated. I'm willing to pay for some support if you can get it running. Shoot me an email if you can help. In the meantime, I'm going to remove this component and go about the file uploads some other way.
Jason
249. Jason wrote on February 10, 2007 at 3:42 PM
My host (hostmysite) got it working for me! Thanks anyway!
Jason
250. Jason wrote on February 10, 2007 at 5:11 PM
My final hurdle...

My form includes 3 panels which use your uploader. When the form submits, I want the server filenames of each of the files emailed to me along with the content of the other inputs. I'm not sure how to target each file in my sendmail script. I read that you can't pull the server filename, so I suppose I'll have to rename the files on submit.

Thanks!
Jason
251. Jason wrote on February 14, 2007 at 5:39 AM
I got my issue resolved. I used cffile.servername on the upload.cfm page. Thanks anyway!
Marko
252. Marko wrote on February 19, 2007 at 8:36 PM
Hi,

I got the File upload to work using format="flash", but how do I submit other flash form elements to the action page as well? Uploading a file is not very likely to be the only form element. What if there are other elements on the form, e.g. firstName, lastName etc... How do they get submitted?

Your help is much appreciated.

Marko
Alex
253. Alex wrote on February 23, 2007 at 10:33 AM
Hello,
Everything seems to be setup properly, but when I upload a file the progress bar goes to 100% and then I get an error message "HTTP error number:302" and the file is not present on the server. Any ideas? Thanks!!
Alex Egg
If you're using asp.net instead of coldfusion on your back-end check out this C# source that will take care of the server side stuff.

HttpFileCollection files = Request.Files;

System.IO.BinaryReader br = new System.IO.BinaryReader(files[0].InputStream);
byte[] bytes = new byte[Convert.ToInt32(Request.InputStream.Length)];
bytes = br.ReadBytes(Convert.ToInt32(Request.InputStream.Length));
string fn = files[0].FileName;
string path = Server.MapPath("uploads") +"\\"+ fn;
FileStream fs = new FileStream(path, FileMode.Create);
fs.Write(bytes,0, bytes.Length);
fs.Close();
Dave
255. Dave wrote on April 01, 2007 at 11:29 AM
I posted this in the "expanded and explained" section but I'm kindof desperate to get this process working so I'm asking my question again here.

I'm new to just about everything - coldfusion, flash and actionscript. I done a little bit of coldfusion programming and have some background in Perl. I need to be able to post the filename (and file size) of the file that's selected to a database. How can one get the value of the selected filename from the actionscript/flash code out to a coldfusion variable? A sample of how this is done would be greatly appreciated. I know this was asked before but I didn't see any code that illustrated how this was done.

TIA
Juan Pablo
Hello, i have developing the site www.fotocolorcarlospaz.com.ar and i want to add the upload function to my site, but i don't have any idea about programming. Could somebody help me to insert this coldfusion code into my site to upload photos? THANKS!!! My e-mail is [email protected]
Also, I could pay a few money for this job. THANKS TO ALL!!!
Devon
257. Devon wrote on April 20, 2007 at 2:21 PM
Hi
Got this working fine but as soon as I added authentication to my site ie to the backend where the form is, the upload stops working. It says the upload is complete but the file is not there. A bit stumped. Any help would be much appreciated as I would hate to can this functionality. Thanks. Peace love and capoeira
Jeff
258. Jeff wrote on April 25, 2007 at 2:29 PM
I am sorry, but I am totally lost with this onComplete and getURL thing.. I have everything working just fine.. I just need to have the page go back to itself to show the updated files. Can someone please show me code examples of how I am supposed to get the code to show me this?

files.cfm?FOLDER=#URL.FOLDER#

Thank you.. ANy help would be greatly appreciated..
Jeff
259. Jeff wrote on April 25, 2007 at 8:41 PM
I am trying to understand this redirect code concept and not getting it at all.. This is what I am currently doing. Can someplease please show me with full code on how to get a redirect in there after its done uploading the item.

   <cf_flashUpload name="styled" actionFile="upload.cfm?folder=#folder#&folderID=#URL.folder#" onComplete="uploadListener.onComplete = function(){
_root.getURL('files.cfm?FOLDER=#URL.FOLDER#');
}">
         <cf_flashUploadInput progressBarStyle="#progressBarStyle#" buttonStyle="#buttonStyle#" inputWidth="150" />
      </cf_flashUpload>
Alex S
260. Alex S wrote on April 27, 2007 at 10:43 PM
how do i edit .cfm file in Cold Fusion MX , for some reason i cant open it or maybe iam not doing it wrong, or i should use something else to edit .cfm

please help
Alex
Alex S
261. Alex S wrote on April 27, 2007 at 11:50 PM
another question after i download the zip i extracted it into my wwwroot is that what i soppose to do in the first plase? than i http://localhost/fileupload/fileupload.swf
and i can only see white plank page, when i right click any where on the page it shows that there is flash... any ideas how do i make it work
Tim M
262. Tim M wrote on May 01, 2007 at 12:56 PM
Jeff, in case you haven't figured this out yet...

onComplete="_root.getURL('files.cfm?FOLDER=#URL.FOLDER#')"

Or you could post your form to a page for additional processing by setting the action attribute in the cfform tag and calling the following in onComplete.

onComplete="_root.submitForm"

Hope that helps.

tim
Dan H
263. Dan H wrote on May 01, 2007 at 3:02 PM
This is great!

However, I get I/O error when using with MAC OSX, Flash Player 9 and either Firefox or Safari.

Windows works perfect for IE and Firefox.

Any suggestions on how to figure out the problem and fix?
Kevin
264. Kevin wrote on May 01, 2007 at 8:38 PM
I am trying to rename a file when it's uploaded... I downloaded the examples provided at http://www.asfusion.com/blog/entry/showing-an-image-after-upload
but when I run it, it does'nt rename the file...it puts the file in a folder named whatever var I pass to it. For example, If I upload a file called hello.jpg and pass a form var with "nameitthis", I get a folder titled nameitthis.jpg with a file in it called Hello.jpg??? Anyone encountered this??? Very weird.
Pete
265. Pete wrote on May 02, 2007 at 9:53 AM
Is there any way to have an email sent when someone uploads a file? An upload notification email?
Chung Lee
266. Chung Lee wrote on May 10, 2007 at 3:33 PM
I had a problem with the "choose file" or "browse" button but managed to solve it.
I use mach-ii framework and that was why it couldn't recognized the swf file and the upload.cfm. To make long story short, following code works in mach-ii when all the files are saved in /views folder.

<cf_flashUpload name="theFile" label="FILE : "
swf="views/fileUpload.swf" actionFile="upload.cfm">
   <cf_flashUploadInput inputWidth="300" />
</cf_flashUpload>

Note that "swf" attribute has "views" directory while actionFile doesn't have it. I think it is because "swf" attribute is used by the browser while "actionFile" attribute is used by CFML code internally. When swf is wrong, the Browse button doesn't do anything. when "actionfile" is wrong, it throws 404 error after uploading.

Anyway thank you for the nice work, Laura!!!
Randy Taylor
I downloaded the zip file, extracted the contents to a folder called "upload" and FTP'd it to my web server running IIS and CF 7.0.2. I have Flash Player 9 and am not able to see anything but a blank screen when I run the example. You can view my test at http://www.songdiscovery.com/upload/index.cfm.

Any help would be wonderful.

Thanks,
Randy
Randy Taylor
I determined the reason for the blank screen. A virtual directory to the CFIDE folder must be setup for the CFFORM to work.

Hope this helps others who run into the same problems.

Randy
Alex S
269. Alex S wrote on May 11, 2007 at 11:59 PM
I get the message saying "HTTP Error 404 - File or directory not found. Internet Information Services (IIS)"
I have windows server 2003, what and where should i change to fix this problem?

thx
Randy Taylor
HTTP Error number:302 on a Mac in both Firefox 2 and Safari. No file can be uploaded on a Mac. Please help as I need to launch the tool for tomorrow morning and need it to work on the mac.

Thanks
Randy Taylor
One other note, I'm using Windows 2003. When I test the demo on this site with a Mac it works, but when I test the same code on my server it throws the error everytime on the Mac. So I believe it's server related. Need help tracking it down. Please let me know if anyone knows what needs to happen on the server.

Thanks
Tony B
I've been all over the net and through this website and I still can't find a solution in getting the new filename after the server writes it (MAKEFILEUNIQUE). Is there no solution for this? Keep in mind I have used all these examples and nothing works....is my brain fried here? I've tried cffile.serverfile file.serverfile...etc
Laura
Kevin,
Yes, I've seen that. There was a change in ColdFusion cffile behavior and you cannot rename the file there directly. I thought they reverted back with one of the updaters.

Pete,
You can send an email or do anything you want with the file uploaded in upload.cfm file.

Tony,
No, you can't get any data from the action page. I added some notes in the post about that.
Randy Taylor
I had the same issue with file upload and found a solution that worked well for me. I uploaded the file into a temp directory that normally has nothing in it. As soon as the upload was complete the flash file would submit the form that it was in as well as pass the file name that was just uploaded. The action page would then rename the file to something I knew was unique and move it to the final destination directory. This gave me complete control of the file naming as well as allowing me to use this really well done flash upload tool. The only downside would be if two people uploaded the exact same file name at the exact same time and before the form action renamed the file and moved it to a new directory. With the application I am working on the chances of this happening are almost zero.

Hope this helps, my email is [email protected] if I can help in any other way. The flash upload tool works extremely well and I highly recommend it.
Tony B
Thanks for the replies. It is so frustrating that this could so easily be overlooked by the development team. It takes the wind out of my sails with these flash forms. The forms seem so easy to use, yet this one simple thing keeps me from utilizing them fully the way that I want. What a shame. I hate doing inefficient and hokey workarounds just to get something to work. Maybe they can address this in the next update, if adobe doesn't put CF on the back burner.
Tony B
Randy, Thanks for the tip, it sounds like you had some creative ideas, unfortunately one of the sites, I couldn't take a chance on poor server performance by working any more than it absolutely had to. I was mainly setting out to find a good realtime progress bar (in coldfusion) for large media files. This would have worked out great, but the "makeunique" param makes a very usefull tools for this cms application.
Ken F.
277. Ken F. wrote on May 31, 2007 at 6:04 AM
On the upload.cfm page, I get the file name (#file.serverfile#) and set it to a session variable (<cfset session.file = #File.ServerFile#>). This works fine in IE, but in Firefox, the session variables just don't take. Anyone know a fix to this issue?
Tony B
Actually, you shouldn't have any problems with firefox or any other browser(s). The Session.var is kept on the server side. I am currently updating a cart for some clients using more session variables and don't have any problems. I think the issue is with "file.serverfile". From the recent comments, I don't believe you can get the "file.serverfile" from that "upload.cfm" page.
Devon
279. Devon wrote on May 31, 2007 at 7:53 AM
A follow up to a post I made here a while back. I said my file upload stopped working when I added cflogin authentication to my application.cfc page.I have since found that the probable cause is the onRequestStart function. Apparently a flash movie will not function properly if this function is called. Can anyone confirm this for me? And maybe suggest a workaround?
Ken F
280. Ken F wrote on May 31, 2007 at 12:28 PM
Tony, the "file.serverfile" works in IE though. I have the following in the upload.cfm page after the file gets uploaded:

<cfset session.file = #file.serverfile#>

When using IE, I can use #session.file# throughout the application after setting it. Firefox I get nothing though. If you have an idea I can try to get past it, please let me know.
Tony B
I hear ya Ken, however according to Laura, "No, you can't get any data from the action page" And aside from that, as I mentioned, the Session variables are server side and not browser dependent. So this is why it doesn't make much sense to me. Can you post your entire "upload.cfm" script.
In addition to the "application.cfm", Where you initialize the application. Or just email to me at [email protected]

I'm not saying your stupid or anything, so let's just take a look at the code so I can see if I can duplicate the problem.
Laura
Ken,
See my reply above: http://www.asfusion.com/blog/entry/file-upload-with-coldfusion-flash-forms#comment-253
and other people commenting on the same.
Laura
Tony,
It seems that Flash Player 9.0.28 added the feature that allows you to get information back from the action page. You can check the docs: http://livedocs.adobe.com/flex/201/langref/flash/net/FileReference.html#event:uploadCompleteData
and this blog post that gives an example: http://stacyyoung.org/2007/05/25/receiving-data-in-response-to-file-upload-in-flex/

By the way, the problem that Ken has is a bug in the Flash Player (which I believe it has been fixed since I haven't seen that problem in Flex). If you look at the headers sent by the browser, you will see that the cookies (required for maintaining sessions) are not sent correctly and therefore what you place in the session scope goes to a new session instead.
Tony B
Laura,
Thanks for the info. I hope it helps Ken out. My biggest disappoint with all of this is just the simplicity of the problem. I am really hesitant to use the Flash forms due to these small things, mainly because I hate doing work arounds if it's not necessary.

What really brought me back here to this forum was the need for a good progress bar for large media files, then to encounter this, is just a little unnerving. I was hoping to do some major applications with major traffic to try and get more people to look at this technology a little more. I love coldfusion and the direction it has taken. I've personally been using CF since version 5 was released and have been impressed completely with my experiences.

Ever since Adobe acquired Macromedia, my biggest fear was that CF would sit on the back burner and phase out eventually. Now that I have major projects with major exposure, I was hoping to start really diving into the new MX more and see if I can't help contribute more to keeping the CF movement alive.

I have NOT tried FLEX yet, so I'm certainly interested in any input you and the community may have. Is it very different from Flash or just slightly? Do you think that it provides as much of a robust platform to work with?

THanks again for your time.

Ken,

I hope Laura helped you out, my only other thought for a work around, with previous flash versions, would be to grab the filename before it hits the server, search the destination folder for a matching string and then generate a random number extension to the filename. This, to me, defeates the whole purpose of "file.serverfile", so I can't say that I would personally go that route. Randy had a good creative idea before to get around this, however I am just one of those people that doesn't like to put the server through more than it absolutely has to. Especially for high traffic sites.
Ken
285. Ken wrote on June 01, 2007 at 12:11 PM
Laura/Tony, thanks for the info. Here is my upload script which currently works in IE:

<cfif structkeyexists(form,"Filedata")>
<!--- upload file with whatever attributes you need, additional variables may come in url scope --->
   <cffile action="UPLOAD" filefield="Filedata" destination="#GetDirectoryFromPath(GetBaseTemplatePath())##application.settings.filepath#" nameconflict="MAKEUNIQUE">


<!--- Create session variables for the file information to display on the confirmation pages --->


<cfset session.file = #File.ServerFile#>
<cfset session.contenttype = #File.ContentType#>
<cfset session.contentsubtype = #File.ContentSubType#>
<cfset session.saved = #File.FileWasSaved#>
<cfset session.renamed = #File.FileWasRenamed#>
<cfset session.created = #File.TimeCreated#>



<cfset AddFileInfo = application.user.AddFileInfo(name)>

</cfif>
Jim
286. Jim wrote on June 03, 2007 at 6:11 PM
Ok,

I have the basic concept of the file upload, but I need to do a download form as well.

I have a cfgrid populated with the data I need. If a user selects a row in the grid the details are displayed in some bound fields to the right of the grid.

I would like to put a button on the flash form that says download and well does just that, downloads the actively selected row in the grid.

Now I am new to this stuff and have really only written one template, the template is completely data driven. The tabs on the tabnavigator are based on a query. The sub tabs present beneath a tab are based on a query and grouped to the parent tab, the cfgrid is based on a third query that is bound to the sub tab. The details are based on the grid.

So as you can see, I do not have that much experience and would greatly appreciate any help you can give me.

I do not know any action script, my background is with databases and not html/cfml. I would like to add the download button in the cfformgroup after the cfgrid section.
I am sorry for the length of the post. The template is about 170 lines long.

Here is my template.

Thanks

Jim


------------------------------------------------------------

<!---
Name:         MFR_Rule_Download_Form.cfm
Author:         James Schell
Description:   Dynamic flash tab form with dynamic sub tabs and a dynamic flash grid and dynamic details bound to grid control
Created:      06/01/07
Last Edit Date:   06/02/07
Revisions:      06/02/07   added sizing to grid control
                     added comments throughout
                     added panel control
                     added horizontal box
                     added two vertical controls to hold grid and detail fields
                     detail fields bound to cfgrid control selected rule

Revisions Needed:         finish detail fields
                     change them to textarea as needed
                     edit name attributes as needed   
                     add hyplerlink attribute for downloading purposes                  
--->


<!--- Begin creating flash form --->
<cfform format="flash" name="Tabs" skin="haloblue" width="800" action="formdump.cfm">


<!--- Query for Parent tabs --->
<cfquery name = "GetParentTab" dataSource = "rules">
SELECT RMSTab
from Rules
group by rmstab
</cfquery>


<!--- Begin creating parent tab control form --->
<cfformgroup type="tabnavigator" query="GetParentTab">


<!--- Start loop query for parent tabs --->
<cfloop query="GetParentTab">


<!--- Insert new tab for each value returned in the GetParentTab Query --->
<cfformgroup type="page" label="#GetParentTab.RMSTab#">


<!--- Begin creation sub tab control form --->
   <!--- Query for Sub tabs --->
   <cfquery name = "GetChildTab" dataSource = "rules">
   SELECT RMSSubTab
   from Rules
   where RMSTab = '#GetParentTab.RMSTab#'
   group by rmssubtab
   </cfquery>
   

   <!--- Create tab control for each value retuned in the GetChildTab Query that is linked to a Parent Tab --->
   <cfformgroup type="tabnavigator" query="GetChildTab">
   
   
   <!--- Start Loop for child tabs --->
   <cfloop query="GetChildTab">
   
   
   <!--- Insert new tab for each value retuned in the GetChildTab Query --->
   <cfformgroup type="page" label="#GetChildTab.RMSSubTab#">


<!--- Begin creating grid control and details about each rule on each sub tab --->
      <!--- Query for Rules --->
      <cfquery name="GetRules" datasource="rules">
      SELECT RuleFileName, RuleKey, RMSSubTab, Caption, tablename, shortdesc, fieldname, file
      FROM Rules
      WHERE RMSSubTab ='#GetChildTab.RMSSubTab#'
      </cfquery>
      
      
      <!--- Create grid control for each recordset returned that is linked to a sub tab which is in turn linked to a tab --->
      <!--- Create two flash forms inside the subtab, one for the grid control and the other for the details about the selected rule --->         
      <!--- Create a panel inside the sub tab to hold the grid control and detail controls that are bound to the cfgrid control --->   
      <cfformgroup type="panel" label="Select a rule from the grid to see the details about it">
         
         
         <!--- Create a horizontal divided box inside the sub tab --->
         <cfformgroup type="hdividedbox">

   
            <!--- Create a vertical box inside the previously made horizontal box to hold the cfgrid control --->
            <cfformgroup type="vbox" width="350" label="Rules">

      
               <!--- Create grid control with a dynamic name --->
               <cfgrid name="Grid_#GetRules.RuleKey#" width="300" query="GetRules">

               
                  <!--- Set column and row values --->
                  <cfgridcolumn name="RuleFileName" header="Library Key">
                  <cfgridcolumn name="Caption" header="File">

               
               <!--- End of grid control creation --->
               </cfgrid>

            
            <!--- End of vertical box creation --->
            </cfformgroup>      

         
            <!--- Begin creating vertical box inside horizontal box to hold detail fileds that are bound to the cfgrid selected rule --->
            <cfformgroup type="vbox" width="350" label="Details">       

      
               <!--- Create bound fields, names must be dynamic as well as the bind information, use the actual fieldname from the
               table as the prefix to the name atrribute --->
               <cfinput type="text"
                      name="shortdesc_#GetRules.RuleKey#"
                      label="Short Description"
                      bind="{Grid_#GetRules.RuleKey#.selectedItem.shortdesc}" >
                     
               <cfinput type="text"
                      name="tablename_#GetRules.RuleKey#"
                      label="Table"
                      bind="{Grid_#GetRules.RuleKey#.selectedItem.tablename}" >
                     
                <cfinput type="text"
                      name="fieldname_#GetRules.RuleKey#"
                      label="Field"
                      bind="{Grid_#GetRules.RuleKey#.selectedItem.fieldname}">
               
                <cfinput type="text"
                      name="file_#GetRules.RuleKey#"
                      label="{Grid_#GetRules.RuleKey#.selectedItem.file}"
                      bind="{Grid_#GetRules.RuleKey#.selectedItem.file}">      
      
               <cfformitem type="html"
                        height="200"
                        width="300"
                        bind="{'<p><a href=\' '+Grid_#GetRules.RuleKey#.selectedItem.file+' \'>Click to Download File</a></p>'}">
               </cfformitem>
      
      
            <!--- End of vertical box creation --->   
            </cfformgroup>

               
         <!--- End of horizontal panel creation --->
         </cfformgroup>      

         
      <!--- End of panel creation --->
      </cfformgroup>      
            
      
   <!--- End creation of sub tab page --->
   </cfformgroup>
   
   
   <!--- Loop for next value in the sub tab query to create a new sub tab page--->
   </cfloop>


   <!--- End of Sub tab Control --->
   </cfformgroup>


<!--- End of parent tab page --->
</cfformgroup>


<!--- Loop for next value in the parent tab query to create a new parent tab page --->
</cfloop>


<!--- End of parent tab control --->
</cfformgroup>


<!--- End of flash form creation --->
</cfform>
Ken F
287. Ken F wrote on June 08, 2007 at 7:47 AM
Laura,

I am getting the 500 error when I try to upload large files only. Smaller files seem to work fine. I set the post data and request throttle memory to 400MB, but it still won't let me upload anything over 200MB. Anything else I can try? Thanks!!
Darrin
288. Darrin wrote on June 09, 2007 at 3:24 PM
Hey I am geting a 404 error every time no matter what i put in for the path to the action file.

Here is my code, if someone can help me that would be great...

<cfform format="flash" height="330" width="515" skin="halogreen" name="serialListings" id="serialListings" enctype="multipart/form-data" method="post">      
                           <cfformgroup type="panel" label="Serial Uploads Listing">                              
<cfinput type="text" name="tFriendlyName" id="tFriendlyName" label="Friendly Name" width="150">
<cf_flashUpload name="styled" actionFile="upload.cfm" label="File Search">
    <cf_flashUploadInput progressBarStyle="#progressBarStyle#" buttonStyle="#buttonStyle#" inputWidth="150" />
</cf_flashUpload>
<cfinput type="button" name="btnReturnCL" id="btnReturnCL" value="Return" onClick="#returnBtn#">
                           </cfformgroup>
                        </cfform>
Nathan
289. Nathan wrote on June 11, 2007 at 8:48 AM
Is there a way to make the form go to a confirmation page once the file has been uploaded?
Ken F.
290. Ken F. wrote on June 12, 2007 at 12:08 PM
Nathan,
Yes, all you need to do is go into the flashuploadinput.cfm file and add a line of code under the onComplete function. Here is what I did:

<cfif attributes.progressInfo>uploadListener.onComplete = function()
   {
      output.text = "Upload Complete";
      _root.getURL('confirmation.cfm');
      <cfif len(onComplete)>#onComplete#();</cfif>
   }
   </cfif>
Ken F.
291. Ken F. wrote on June 12, 2007 at 12:14 PM
Laura,
Solved my problem above. I increased the max size of JVM Heap Size in the CF Administrator to 1024MB (default was 512). "500" errors dissapeared and files upload successfully up to 300 MB.
Ryan Hudy
292. Ryan Hudy wrote on June 26, 2007 at 7:40 AM
This is awesome! What I need to do is have the form submission (the form has other fields besides the upload) and the upload occur at the same time, with that file being associated with the record just submitted. Has anyone done something similar?

Thanks...again, great job!
Devon
293. Devon wrote on June 26, 2007 at 7:58 AM
Ryan, if thats the case then you don't really need this...just submit the page and put the call to the cfc(or however you are inserting into the DB) and the upload script on the action page...
If you really want to use this you could probably use flash remoting (just type it in the search and check out the asfusion articles on it) but I wouldn't recommend it as the user will probably click the submit button over and over, expecting a new page to load.
Now if anyone has had any success using this behind Coldfusion cflogin based security, please let me know. Apparently the Flash does not work if onRequestStart is called? It displays fine, says its done but no image to be found...remove the security and voila! it works...
Ryan Hudy
294. Ryan Hudy wrote on June 26, 2007 at 11:44 AM
OK, I got my problem solved....somewhat...

I developed the form with the file upload field. The catch is that the file needs to be uploaded first, then when the form is submitted, it captures the file name and records it being associated with that record (storing filename in db). The only problem I have now is creating some sort of validation, as users can browse for their files, find out, and don't hit upload. That will create the filename in the db, but no actual uploaded file. Any clue as to how to do that?
Ken F.
295. Ken F. wrote on August 01, 2007 at 2:05 PM
Ryan,
Why not just have the user upload the file first, then auto-redirect them to the form to fill out the remaining fields while passing the previously uploaded file name in the url string or through a session variable? This way, if they upload the file and quit, no record in the db will get created. See my above post for more on this(#290).
Tony B
Ken,

You don't really want to take that route of redirection. I like that your thinking differently, however the two main issues would be adding another page redirection, which in my opinion cuts down on efficiency and what the user might be used to, but more importantly, you may not have the db entry, but you now still have a file sitting on the server that has reason to be there. Over time, many files that get lost like this take up space and bog down server performance. It would just be sloppy datamanagement.

In my mind it would just make this one issue so much easier and more effiecient to find a way to get the new server filename just as you would through a regular cffile form tag.

:)
Leah
297. Leah wrote on August 01, 2007 at 2:38 PM
Hi, all,
I am trying to grab the uploaded file name for further use. I cannot assign neither session nor cookie variable from the upload.cfm.
I tried something similar to what Ken suggested in post #285, but it doesn't work.
I am running CFMX7 on Linux. OSX/Safari&FireFox or Windows VM/IE.
Session and cookie management enabled.
I was able to email myself the value of #file.ServerFile# without a problem.

Any suggestions?
Dave c
298. Dave c wrote on August 01, 2007 at 5:07 PM
Hi,
how can i use multipule cf_flashUploadInput's with one
submit button on a cfform?
Greg
hello,
i'm trying to add an input query after an image file is uploaded... any help would be appreciated.
TIA,
Greg

what i've tried so far:
in upload.cfm
i've tried to ride in on the cfif by adding my cfquery
<cfquery name="Filedata" datasource="bido">

insert into Images (
image
)
Values (
'#myform.name#'
)
</cfquery>
nothing fancy, but i wanted to use this file upload as the engine to put photos up in a private gallery i'm building.

http://gcm.syr.edu/bido login with t2h/t2h

Thanks,
Greg
Harkirat Singh
300. Harkirat Singh wrote on August 16, 2007 at 3:54 PM
After upgrading to Coldfusion 8 I noticed that the 'Choose File' feature no longer works and no window pops up to allow you to browse and select a file? Has anyone else had this problem and if so any workarounds?
Dave
301. Dave wrote on August 18, 2007 at 10:41 AM
Greg -

I assume the insert query you gave as an example executes after the cffile that saves the uploaded file. If this is the case, change the name of your query; you might have a problem with naming it the same as the file upload data. Second, the filename to insert into your db should be #cffile.serverFile#. Then you can reuse the functionality whether the uploaded file was renamed or not. The 'serverFile' var in the cffile result is the name given to the file after it's been saved. Sometimes it's the same as the filename as the user selected it, sometimes it's not.
Patrick
302. Patrick wrote on August 27, 2007 at 8:23 AM
Awesome!! I wondered why Adobe didn't implement File Upload in CF 8 FlashForms?
Greg
Dave:

Yes, that's basically what i ended up doing, but as it turned out my host only has cfmx 6.1 - so had to fallback to an input field. at least i learned how it works now.
http://gcm.syr.edu/nemas/index.cfm got a cool dynamic frame to work... now just to figure out a smoother way of giving choices on the frame thing :-\

Thanks,
Greg
Greg
Dave:

Yes, that's basically what i ended up doing, but as it turned out my host only has cfmx 6.1 - so had to fallback to an input field. at least i learned how it works now.
http://gcm.syr.edu/nemas/index.cfm got a cool dynamic frame to work... now just to figure out a smoother way of giving choices on the frame thing :-\

Thanks,
Greg
Greg
Dave:

Yes, that's basically what i ended up doing, but as it turned out my host only has cfmx 6.1 - so had to fallback to an input field. at least i learned how it works now.
http://gcm.syr.edu/nemas/index.cfm got a cool dynamic frame to work... now just to figure out a smoother way of giving choices on the frame thing :-\

Thanks,
Greg
Patrick
306. Patrick wrote on August 28, 2007 at 4:26 AM
Doesn't work for me. I put the example files in my htdocs, changed the upload.cfm to meet my system. Now tried to upload some jpegs. The Progress bar shows 100% upload completed, but there is nothing in my destination folder.And there is no error thrown, i also checked the log files. nothing. I have FlashPlayer 9 running on my testing machine.

I use CF 8 Developer Edition on a windows 2003 server box with apache 2.2

Hint?
Harkirat Singh
307. Harkirat Singh wrote on August 29, 2007 at 2:57 PM
I am having issues using this tag with CF8. After installing CF8 this tag stopped working. It was working fine before the installation. Has anyone else had any similar issues. If so please do reply to me and let me know. Thanks.
Ben
Any word on a fix for this coupled with CF8?
Mark
ok I cannot get my form to work whatsoever with my site. I need complete help... My .cfm files and swf file are sitting in the maid directory and I inserted the code. Is there any other code that I need to add first???
Ken F.
310. Ken F. wrote on September 12, 2007 at 8:38 AM
Just a quick question. Anybody know where in the flashuploadinput.cfm file I can just run a replace and eliminate spaces in the file name that the user chooses to upload? I would prefer to do it before it gets uploaded in order to avoid having to do a rename. Thanks!
Laura
Harkirat and Ben,
I just installed CF 8 and this still works. Do the flash forms work for and and it is only the upload that doesn't work? or neither works anymore?
Make sure your cfide/scripts directory is browser-accessible.
Harkirat
312. Harkirat wrote on September 12, 2007 at 2:01 PM
Hi Laura,
The flash forms work fine, just the tag does not respond. When I click on the button to 'Choose File' nothing happens. The 'Upload' button does not respond either. It does appear to me that the scripts have stopped functioning for some reason. However I checked the CFIDE/scripts directory and it is browser accessible. My custom tags directory is also properly configured and all other tags in it respond fine.

I have flash player version 9,0,47,0 running on the server and on my client machine. I don't know if that would make a difference. My server is running windows 2000 with IIS web server.

I will keep experimenting to see if I come up with any clues. I sure hope I can make this work. This is keeping me from installing the CF8 on my production server.
CN
Hi Laura,
I have similiar question with some another post, but after read all that I am still not complete understood yet how to do it.
Here is my situation:
I have Action_form & Submit_Form already, that form submit all the entry data to access database.
I am also add another field for file name, I am adding Upload link to this Action_form, after click the link will popup index.cfm and display the upload page.
What I would like to do is after upload file complete, can I display the "filename" under Action_form? so I can save that file name to the access with all another field.

Any help would be greatly appreciated!

By the way, I Just wanted to say this upload script is awesome. Thank you so much for helping
Steve
314. Steve wrote on September 26, 2007 at 4:57 PM
Laura,

Thank you and everyone else here for helping me so far. I've got the multiple file upload working fine now but am having a problem with Windows Authentication.

Like I said, the uploads are happening, but the Windows Authentication box pops up (randomly?) looking for my Username and Password. I provide the Username and Password (sometimes multiple times, for multiple files) and the uploads work after that.

Is there something simple I am missing that is causing this Authentication to pop-up?

Thanks a bunch!
Ed
You might get the pop-up window if you have NT Challenge turn on and anonymous login turned off on the web server params....

Ed
scott
316. scott wrote on October 18, 2007 at 9:50 AM
Can't get the demo to work on my development system.

I also have the problem where the choose file button doesn't open the browse window. Runing Flash 9. Flash forms do work of course but what does the advice of "Can you browse the scripts directory" mean?

All the files are in the same directory so I assume there are no issues with pathing and all that jazz. Any advice?

If I can get it to work it will be EXACTLY what I'm looking for.

Thanks,
Scott
scott
317. scott wrote on October 18, 2007 at 9:51 AM
I forgot to mention that i'm running MX 7 not 8
Harkirat Singh
318. Harkirat Singh wrote on October 18, 2007 at 10:08 AM
Hi Scott,
I am having the same problem on my development server and everything seemed to work fine when I had MX7 but as soon as I installed the beta version of CF8 it stopped working and I still haven't figured out why. I am now wondering if there was a bug in the beta version that caused this beviour because I installed the final version of CF8 on my production machine and the everything works fine on that server. Did you by any chance also have the beta version installed on the server.

I believe by browsing the script directory Laura meant that the directory could be invoked by a call from a web browser.
Perhaps Laura can better clarify that.

Harkirat
scott
319. scott wrote on October 18, 2007 at 10:49 AM
Harkirat

http://localhost/cfide/scripts/cfformhistory.cfm

I can run this page in the browser, so does that mean the directory is "browseable"? I am running the developer version of 7.1 and have not installed any version of 8.

Could the fact that i'm running the developer version have anything to do with it?
scott
320. scott wrote on October 18, 2007 at 11:01 AM
Harkirat

http://localhost/cfide/scripts/cfformhistory.cfm

I can run this page in the browser, so does that mean the directory is "browseable"? I am running the developer version of 7.1 and have not installed any version of 8.

Could the fact that i'm running the developer version have anything to do with it?
Harkirat Singh
321. Harkirat Singh wrote on October 18, 2007 at 11:16 AM
Hi Scott,
I believe that is correct but I would confirm with Laura.

It would appear that it might have something to do with the version of coldfusion one is running as I had issues with the beta version (which is essentially a fully functional trial edition with perhaps some limitations built into it) and you seem to be having issues with the developer version. It should have worked however when I installed the full version of CF8 but I did have considerable difficulty installing it on my developer machine and had to manually uninstall the beta version and then install the full version which could have messed up things for me.
scott
322. scott wrote on October 18, 2007 at 11:47 AM
Harkirat,

Thanks that was the problem. The deveoper version does not apparently support this. Got it to work on a "production" install of it right away.
Harkirat Singh
323. Harkirat Singh wrote on October 18, 2007 at 12:08 PM
Glad to see it worked for you Scott. It still doesnt work for me on my development machine which is running a 'production' version :(. Well atleast the one running on my production machine works fine. I guess I can live with that.
Vadim
I'm trying to make the 'uploader' to go to the next page when uploading is done.

I have tried by adding the following in the uploadListener.onComplete = function()

<!--- start added stuff for redirect --->
getURL("http://www.domainname.com";;);
<!--- end added stuf for redirect --->

The getURL does not work :-(

Anyone here who might have a hint, on how I can get this done?

------------------------------------------------------------

Adam, take this sample, I hope it will help to you... :

uploadListener.onComplete = function()

<!--- start added stuff for redirect --->

_root.getURL("http://www.website.com";, "_self");

<!--- end added stuf for redirect --->



Vadim
Vadim
Sorry, i made a mistake, it should be:

_root.getURL("http://www.website.com";, "_self");

Good luck!



Vadim
John H.
326. John H. wrote on November 06, 2007 at 6:51 AM
Hi, Laura,

In your post under "notes on error codes" you suggest that one looks at the "java output logs, not the regular cf logs." We've been having a problem of users getting a white (browser) screen when an upload times out (at least we THINK it's timing out), and hoped that the issue would go away with CF 8.0. Apparently, it has not and I'm (still) searching for the cause and solution. Could you tell me which java files might shed more light on this issue? Nothing in our ColdFusion 8.0 directory looks like the log you describe. Any information (name/directory) you could suggest would be grately appreciated.

Thanks! John
Casey Dougall
Hello,

I was attempting to track down an IO Error and though initially it was an flashupload issue but it turns out, it's coldfusion... There is a setting "Max Size of Post Data" I had this set to 100meg and upping it to 300 meg resolved the IO Error.
Felix Kreitner
Hi,
i tried the flash upload with ColdFusion 8. Every time was trying to upload a huge file like 300MB i got an IO Error. In the ColdFusion Administrator i set the "Max Size of Post Data" to 1000 MB, but with no success. I still get the IO Error. Any idea what i can do?
Thanks!
Felix
George Smith
Is there a Flex 2 demo / tutorial just like this?
or at very lease a create folder tutorial? I have all the rest down pat..
George
Malik
330. Malik wrote on November 27, 2007 at 1:24 AM
Hi,

I am using this code and it seems to work, however I am having a small issue. I am using a different button to process the upload, but I would like to send the data from the form at the same time. Is there a way I can get at this function??

<cfinput type="button" name="btnUpload" onclick="#myUpload_uploadScript#" value="Upload" tooltip="Upload" />

Where does that script live? I can't find it for the live of me? I am thinking in the .swf file?? If so, is there a way I can also submit the data in the form at the same time? Maybe thru hidden fields or some other way? I would like the form data and the upload to happen at the same time essentially.
Brian Boyer
331. Brian Boyer wrote on November 27, 2007 at 8:33 PM
I tried using this tag on Mac OS X 10.4 / CF Developers Edition 8 and couldn't get the client side browse button to work at all. However, the authors website works fine on the same machine.

I then tried using this tag on Windows 2000 / CF Developers Edition 8. The browse button works on the client; however, the upload doesn't seem to work. The client reports upload OK, but no file can be found in current, or any other directory on server. I have tried several different destinations, both abosolute and relative paths, but nothing works. Do I need the output tag? The example doesn't include it.

I have checked permissions and everything else...wasting many hours...

I have concluded one of two things:
1) Either this custom tag does not work with CF Developers Edition <OR>
2) This script just does not work, at least for me...
Malik
332. Malik wrote on November 28, 2007 at 12:57 AM
Sounds like a path issue Brian. Are you using Fusebox? If so, you need to do it slightly different.
S. Jagan Langa
333. S. Jagan Langa wrote on December 07, 2007 at 8:54 AM
Hi every body,
I have created a multi-file uploader which works fine in Windows but it throwing IO-Error in Mac OS when the file name have whitespace in it, but not in Window, Any body know why it is? if so please tell me. i will be happy
Lawrence
If its opensource, where is the fla?

OH and the image recognition is really hard to get past. 5 attempts
David
335. David wrote on January 03, 2008 at 7:51 PM
I am getting random IO Errors using this script, and the newer one you recently posted. I am trying to upload some fairly large files, but why should it matter? Why can't ColdFusion reliably upload files in a user-friendly way? It's seems incredibly hard to find a good, reliable solution to this problem so many years and versions into ColdFusion. If anyone knows of a REAL rock solid way of uploading large files through ColdFusion (e.g., up to 1Gb or larger) PLEASE contact me. I need a solution that actually works. Btw, the IO errors happen whether on Windows or Linux. Sometimes 1/2 the file will get uploaded, sometimes only a small fraction. Totally random.
David
336. David wrote on January 04, 2008 at 10:20 AM
I can confirm that the upload error seems to hinge on a 200mb limit, but I don't know whether this is something to do with Flash itself, or something else I am not aware of. In today's age with video and file sharing so popular, it is very easy to understand why the need exists to be able to upload perhaps unlimited file size. For my particular application I need at LEAST 1Gb upload functionality. If Flash or Flex cannot do this, does anyone have another idea? A java applet perhaps? Please let me know.

By the way, since discovering this blog and its example code, I have since moved on to the CF_TagStore's "ProFlashUpload" tool http://www.cftagstore.com/tags/flashmultipleupload.cfm but still I get errors when trying to upload more than 200mb. Besides that, it's a great multi-file uploader!!
David
337. David wrote on January 04, 2008 at 11:51 AM
Nevermind, I missing the "Request Throttle Memory" parameter. It was set to 200mb. Duh. That's what I get for working late at night. However, there are still times when a file is being uploaded and will randomly get an IO error, but that seems independent of the file size at this point. Sorry!
Branden
I am on a win2k box with cf8 developers edition. I can get the flash to display on the page, select a file, upload the file, show that it was uploaded successfully. Now here's the part I don't understand. The form never submits the file anywhere on the server. I've tried different actionfiles with fusebox paths, regular paths, whatever. I really like the way this all works, I just wish it posted to the normal action page.

Any help would be greatly appreciated.

Here is my code from the form page.


--->
<cfsavecontent variable="buttonStyle">
corner-radius: 2;
borderThickness: 0;
fill-colors: #3300ff, #7897df;
color: #ffffff;
</cfsavecontent>
<cfsavecontent variable="progressBarStyle">
border-thickness:0;
corner-radius: 0;
    fill-colors: #e4e4e4, #3300ff;
    theme-color: #e4e4e4;
    border-color:#000000;
    color:#ffffff;
</cfsavecontent>
<cfsavecontent variable="outputStyle">
   borderStyle:none;
   disabledColor:#e4e4e4;
   backgroundAlpha:0;
</cfsavecontent>
<cfsavecontent variable="contentPanelStyle">
   panelBorderStyle:'roundCorners';
   backgroundColor:#e4e4e4;
   headerColors:#789ccf, #78d2ff;
</cfsavecontent>   
</cfsilent>
<cfform width="420" format="Flash" timeout="200" enctype="multipart/form-data" method="POST">
   <!--- skinned --->
   <cfformgroup type="panel" label="Upload #divisioninfo.divisionname# Videos" style="#contentPanelStyle#" width="400">
   <cf_flashUpload name="ul_path" actionFile="upload.cfm">
         <cf_flashUploadInput choosebuttonlabel="Choose Video File" progressBarStyle="#progressBarStyle#" buttonStyle="#buttonStyle#" inputWidth="150" />
      </cf_flashUpload>
   
   
   <!--- <cfformitem type="text" style="fontWeight:bold">Trigger upload from other button</cfformitem> --->
   <!--- <cf_flashUpload name="ul_path" actionFile="index.cfm?action=uploadvideo">
         <cf_flashUploadInput uploadButton="true" required="true" message="File is required" />
      </cf_flashUpload>    --->
   </cfformgroup>
   
</cfform>

Since this never seems to hit the action page, I don't know where if at all that the uploaded file has been put. I've searched the filename I've been testing with on the server and have not found more than 2 even though I've uploaded it more than 40 times.
So answer this for me...
Where does the file go?
How do I access it?
How can I run the cffile action upload... after running this.
How should this all be organized other than what I've got already...

Love the tags so far just want this last step to work!
Branden
Also, the actionfile I'd really like to post to is

index.cfm?action=uploadvideo

As this is a fusebox 1 structured application.
Branden
Also, the actionfile I'd really like to post to is

index.cfm?action=uploadvideo

As this is a fusebox 1 structured application.
Kris Kendrick
I don't think anyone is responding to new comments or support concerns about the flash forms here :(

One thing I have noticed about this app is that it is VERY picky about where it lives. It likes to be right in the root of a web site and needs access to the <CFIDE/scripts> directory, or you have problems in IE.
Branden
Also, the actionfile I'd really like to post to is

index.cfm?action=uploadvideo

As this is a fusebox 1 structured application.
Chris
343. Chris wrote on January 10, 2008 at 10:05 AM
All I get is "40% Please reload. RSL Load Failed!" when I try to bring up index.cfm.
jeremy
344. jeremy wrote on January 13, 2008 at 6:49 PM
I'm impressed that this conversation has gone on for so long. Quick question, and I thank you all very much for your time. I have this on a "close button" on my action page:
getURL("javascript:CloseHer()");

the javascript:
<script language="javascript">
   function CloseHer()
   {
   parent.location = "randompage.cfm";
   }
   </script>


This works great because it's on the action page.

My question (seems to be one many were asking and I've not found a suitable answer): what code do i write to make upload.cfm cause my action page to redirect? cflocation obviously won't work... geturl() inside mx script tags? any workaround would suffice to abort and go do a different page.

Thanks again.
jeremy
345. jeremy wrote on January 14, 2008 at 12:24 AM
@Branden

Looks like nobody's really reading these. I'll answer your question quickly however. "Actionfile" has nothing to do with the fusebox model, which I'm sure you know, but I'll elaborate.

The actionscript of this example calls the 'actionfile' to process the image upload via <cffile> (or whatever else you want to do...). You could put all your processing code under index.cfm?action=funkymonkey, but don't expect anything to display -- it will process the code and return a success, a 404, or a 500 if an error was thrown. If you're having problems, make sure error handling is turned off until you're ready to spit out a finished product.

as for the actionfile, if you ONLY put a cfquery in upload.cfm without a cffile to process the file upload, and nothing is "cfthrown" then the thing will return "upload successful."

I'll help you as long as nobody is nudging me in the right direction. :-) (all i want is to pass a variable from upload.cfm to uploadListener.onComplete. Can't say I've ever been an actionscript fan!)
Garry D. Rowland
I have uploaded the cfform to my application using fusebox 3.0 and it won't display the file select box. However, when I post it as a standalone app in the webroot it works.

Any idea what is going on?
kalderm
347. kalderm wrote on January 31, 2008 at 3:37 AM
I'm able to use in IExporer but not in Firefox client. Using Mozilla browser I do not get any errors but the file isn't really uploaded. In both browser are installed Flash player 9.

any suggestion?

Thanks
kalderm
348. kalderm wrote on January 31, 2008 at 3:57 AM
I'm able to use in IExporer but not in Firefox client. Using Mozilla browser I do not get any errors but the file isn't really uploaded. In both browser are installed Flash player 9.

any suggestion?

Thanks
Antoine From France
349. Antoine From France wrote on March 05, 2008 at 1:36 AM
Hello Laura,
we are now using CF8 server.
Cfinput type="file" still not accepted in Flash Forms.
But I read that your nice app is not running anymore under CF8. Can you confirm and/or recomand a alternate solution ?

Thanks in adavance
Antoine.
Antoine From France
350. Antoine From France wrote on March 05, 2008 at 5:34 AM
Laura, your app is working vine on CF8, Sry for the mistaken information.
Now, I've got a little problem wich, I presume, is more ActionScript relevant.
In my form ("cursus") I've got 3 Tabular formgroups ("degree", "speciality", "cours").
In the tab "cours", i've placed your app and a cfselect ("cours_files") in whitch uploaded files are listed.
Is there a way for me to add the uploaded file name into the cfselect when the upload is completed ?
I tryed this, into the flashuploadinfo.cfm file :
<cfif attributes.progressInfo>uploadListener.onComplete = function()
   {
      output.text = "Upload ok, do not forget to save";
      <cfif len(onComplete)>#onComplete#();</cfif>
      alert(_root.cursus.elements.cours.cours_files.selectedIndex);
   }
   </cfif>

You certainly noticed that I used a simple 'alert' instead the 'AddItemAt' function that will fit my needs, but it is simplier to test. today's returned value is "" (empty string).

Any help will be very appreciated.
Thanks anyway for your work.
Antoine.
Antoine From France
351. Antoine From France wrote on March 05, 2008 at 6:42 AM
Ok, I did find an solution ... which is not perfect regarding my needs, but I have to go next step.
This will also answer some questions posted here.
I'm using the AJAX feature "submitForm()" into the flashuploadinfo.cfm file :
<cfif attributes.progressInfo>uploadListener.onComplete = function()
{
_root.cursus.edit_cours="yes";
_root.cursus.TAB_src=2;
//these two variables are for display use, not mandatory for others, but it may be usefull to grab the info that you can pass parameters to the form ...


root.submitForm();
//this is the AJAX feature that actually posts the form ...

<cfif len(onComplete)>#onComplete#();</cfif>
}
</cfif>

I'll get maybe more when you will be awake !
Best regards
Antoine.
Nicole
352. Nicole wrote on March 12, 2008 at 9:24 AM
I am using CF8 with Flash Player 9.

Has anyone been able to get this to work within a tabnavigator?

I have a cfform which I have implemented the code within one of its tab. But, when I go to "Choose File" nothing happens. I'd rather keep my app consistent by having the file upload within the tab as opposed to outside.

Any assistance will be greatly appreciated!
Nicole
353. Nicole wrote on March 12, 2008 at 9:25 AM
I am using CF8 with Flash Player 9.

Has anyone been able to get this to work within a tabnavigator?

I have a cfform which I have implemented the code within one of its tab. But, when I go to "Choose File" nothing happens. I'd rather keep my app consistent by having the file upload within the tab as opposed to outside.

Any assistance will be greatly appreciated!
Kris Kendrick
Not sure why people continue to post with issues on this site. This topic, and application development of this app, appears to be a dead issue for asfusion.
Terry Bankert
To anyone that is having a problem getting this thing working via multiple file uploads. I'm sure that my solution is not fool proof, but I was struggling with this app and uploading multiple files using multiple inputs. Again note, my solution is not fool proof, however, basically what I did was two hidden form fields using cfinput
selected_files
completed_files

In the onSelect function in flashuploadinput.cfm above the following code right around line 83 I put the following:
_root.myform.selected_files = ParseInt(_root.myform.selected_files) + 1;
fileNameField.text = selectedFile.name;

Next in the onComplete function I added the following code:

_root.myform.completed_tracks = parseInt(_root.myform.completed_files) + 1;
output.text = "Upload complete";
      
if(parseInt(_root.myform.completed_files) == parseInt(_root.myform.selected_files))
{
_root.submitForm();
}

This submits the form after all files are uploaded to another action page hope this helps someone, and note use it at your own risk. I'm not taking into account if they change the file of a certain upload input.
T.R.
Just thought I would post this in case someone else comes looking. I saw a post here wondering about setting the destination folder dynamically. There are a couple steps needed to do this.

1) In upload.cfm, get the "destination" attribute for the cffile tag from a url variable. For example:

<cffile action="UPLOAD" filefield="Filedata" destination="#url.destination#" nameconflict="MAKEUNIQUE">

(As always, it's probably a good idea to be careful about what you do with url parameters)

2) In flashUploadInput.cfm, pass a url parameter containing the destination to the action file. To do this, change what I believe is line 48 (uploadSwf.upload("actionFile#");</cfoutput>) to this:

uploadSwf.upload("#actionFile#?destination=#variables.destination#");</cfoutput>

This line takes the contents of a variables.destination and sends it to upload.cfm.

3) Change flashUploadInput.cfm to accept the destination as an attribute and store it into variables.destination. To do this, add this line:

<cfset variables.destination = URLEncodedFormat(attributes.destination) />

4) Finally, when calling ct_flashUploadInput include the destination as an attribute. For example:

<cf_flashUpload name="defaultFile" actionFile="/includes/upload.cfm" swf="/includes/fileUpload.swf" >

<cf_flashUploadInput destination="c:\upload_director\" />
</cf_flashUpload>

The path on my server needs to be an absolute path starting at the root. This took some figuring out for me (I'm new at this) and may be different for you.

Of course, a few more lines of code could be added to set a default value for any of these attributes or parameters. But, this should get you started.

T.R.
Mark Holm
357. Mark Holm wrote on March 28, 2008 at 2:20 PM
One issue I have with this.. no security.. if you set a file type as not allowed.. all the application can do is not "see" it in the browse mode. However if you type in a file name - it will upload any file type as the accept attribute of cfflie isn't used because cffile see all up loads in this application as "application/octet-stream:"
Lee
I love this code; however, I need to upload the file to the location with specific information (and not the information the user selected and is spit out by Filedata). Meaning, if the user adds a file named 'data from tables.xls' I need the file to be uploaded to it's location as something like '20080001_data from tables.xls'. I am writing the filename to a SQL dbase as well. Any help on how I can accomplish this? I already saw the previous posts in 2005 about renaming an image that's not exactly what I'm trying to do.
Lee
I love this code; however, I need to upload the file to the location with specific information (and not the information the user selected and is spit out by Filedata). Meaning, if the user adds a file named 'data from tables.xls' I need the file to be uploaded to it's location as something like '20080001_data from tables.xls'. I am writing the filename to a SQL dbase as well. Any help on how I can accomplish this? I already saw the previous posts in 2005 about renaming an image that's not exactly what I'm trying to do.
Terry Bankert
Also if you want to send post data I recommend checking out YUI's file uploader in beta right now. Just integrated it rather easily into a couple of applications, and it works nicely.
http://developer.yahoo.com/yui
Terry Bankert
Also if you want to send post data I recommend checking out YUI's file uploader in beta right now. Just integrated it rather easily into a couple of applications, and it works nicely.
http://developer.yahoo.com/yui
kanu kukreja
362. kanu kukreja wrote on May 28, 2008 at 11:29 AM
getting an IO error while uploading 0 byte file.
Muhammad
363. Muhammad wrote on June 16, 2008 at 9:09 AM
this tag is working fine with firefox but it seems it doesn't work on i.e7. please advise any suggestions
Asher
Hi I was wondering how can I Embed this on my site, I have already download the files but I dont know how to put it on my site so I can use them. I'm Still new to this but if you guys could tell me like the code you guys use and ill just change what i need to make it work on my site. Thanks
chris
I have the form installed and everything seems to work fine but no file is uploaded to the server. I searched the server and don't see it anywhere. I don't think that the upload.cfm is being used. I am trying to upload a csv if that matters. I have checked to make sure the destination is proper which I have set as an absolute.
chris
I have the form installed and everything seems to work fine but no file is uploaded to the server. I searched the server and don't see it anywhere. I don't think that the upload.cfm is being used. I am trying to upload a csv if that matters. I have checked to make sure the destination is proper which I have set as an absolute.
chris
I have the form installed and everything seems to work fine but no file is uploaded to the server. I searched the server and don't see it anywhere. I don't think that the upload.cfm is being used. I am trying to upload a csv if that matters. I have checked to make sure the destination is proper which I have set as an absolute.
Fermin
368. Fermin wrote on August 23, 2008 at 4:33 PM
I get an following error when tring to upload:
Invalid content type: application/x-www-form-urlencoded. The cffile action="upload" requires forms to use enctype="multipart/form-data".


I'm using CF8
Dan
First of all, this thing is awesome. Great work!

I am trying to let the user choose which folder to upload to using CFTREE. CFTREE lets you know the name of folder selected using the javascript variable

myTree.selectedNode.getProperty('data').value;

I want to pass the value of that with a URL variable called path. So the tag looks like

<cf_flashUpload name="styled" actionFile="upload.cfm?uploadpath=[UNKNOWN]">

How can I include the value from the javascript variable at the end of that URL variable. The value of course is also held in the cold fusion variable; #FORM.dataFile.node#. However since the form is not being submitted that is not usable. Any ideas how I can pass the value from the CFTREE to that URL? You can see my app here http://www.test.archmagazine.org/Administration/upload/index.cfm.

Thanks!
Randy Johnson
Here is the code that I used to do the multiple file upload. I cut out all the different examples.

<cfform name="myform" width="420" format="Flash" timeout="100" >

   <!--- if we need to trigger upload from a different button--->
   <cfformitem type="text" style="fontWeight:bold">Trigger upload from other button</cfformitem>
   <cf_flashUpload name="myUpload" actionFile="upload.cfm">
         <cf_flashUploadInput uploadButton="false" required="true" message="File is required" />
      </cf_flashUpload>
   <cfformitem type="hrule"></cfformitem>

   <cf_flashUpload name="myUpload1" actionFile="upload.cfm">
         <cf_flashUploadInput uploadButton="false" required="true" message="File is required" />
      </cf_flashUpload>

   <cfinput type="Button" name="myUploadButton" onclick="#myUpload_uploadScript# #myUpload1_uploadScript#" value="Trigger Upload"/>

</cfform>
Paul
371. Paul wrote on November 19, 2008 at 1:36 PM
How can I change the text of 'Upload Complete'?
Branden
I have been using the flash upload for months and it works great usually. From time to time however, the flash upload reports that the file has uploaded as it should and goes on to the next step without any connection errors or anything. However, the file was never actually written to the file system. I've fixed it in the past by restarting the server, another time I changed the jvm size which made coldfusion not run at all. I was able to get it working by changing the jvm.config file sizes to 512 and it works again. Is this a coldfusion bug, a system bug, a java bug, or what? I'm looking either for a hotfix / patch / or a service I can restart to get this working. It only affects one part of my site as I only use this for video uploads, but lately the server has take up to 40 minutes to restart the server and I really don't want to do that now. Can anyone tell me how to fix this and or tell me what service to restart?
Anthony
373. Anthony wrote on November 25, 2008 at 9:20 PM
can anyone help me, on how to upload and set this up correctly on my website. I upload them and i get nothing but simple white page

I have

cPanel Version   11.23.6-STABLE
Apache version   2.2.10 (Unix)
Operating system   Linux

for anyone who has upload this successfully to their site, it would be nice if i can get some help, thanks
Kris Kendrick
Please make it stop... this code is 3 years too old... and the "it doesn't work" comments just keep on coming.
Barry Brunning
I modified the uploadListener.onComplete function to do some more stuff once my file was uploaded and found sometimes the code was running more than once per Upload click. The reason transpired to be that I had browsed then cancelled, browsed again then uploaded. This results in the addListener statement being executed twice. To fix the problem I have added an invisible text field to my form named Listener, then replaced the uploadSwf.addListener(uploadListener);
statement in "browseScript" with:
   <!--- Ensure we only have one listener --->
   var listener = Listener;
   if (listener.text == ''){
      uploadSwf.addListener(uploadListener);
      listener.text = 'listener';
   }
That fixed it for me. Maybe there's a better solution.
Revathi
376. Revathi wrote on March 11, 2009 at 4:10 AM
am not using coldfusion..is it possible to select n upload file?
Alex Zinchenko
377. Alex Zinchenko wrote on April 03, 2009 at 5:23 AM
Good day, Laura.

I'm using PHP and what to know is it possible to use your uploader with PHP.

Thank you.
Laura
Hi,
For those asking about this in a different language, what is here to download won't help you. You can do it, but you'll have to code it directly in Flash/Flex and your language of choice.
Spencer
How do you call the onComplete actionscript function? Code below working.

<cfsavecontent variable="browseScript">
uploadListener.onComplete = function()
{
output.text = "Upload complete";
uploadBtn.enabled = false;
browseBtn.enabled = false;
}
</cfsavecontent>

.......

<cf_flashUpload name="myFile2" fileTypes="*.jpg;*.png;*.gif" fileDescription="Image files" actionFile="uploadfileprocess.cfm" onComplete="#browserScript#">
Spencer
APPARENTLY I CAN'T TYPE. MEANT NOT WORKING. SORRY!
Neo
381. Neo wrote on April 06, 2009 at 1:04 AM
Somebody could help me, I need to send an email when the upload of file is finish with cfmail tag ?
How to do ?

Thanks
Neo
Barry Brunning
Hi Neo,
You can use Flash remoting in the onComplete function to invoke your cfmail requirement. If you or anyone would like some code email me at [email protected] and put asfusion in the subject line.
Regards,
Barry
Laura
Spencer,
In your browseScript code just add statements, not the function definition, like:
output.text = "Upload complete";
uploadBtn.enabled = false;
browseBtn.enabled = false;
Brad
384. Brad wrote on May 14, 2009 at 6:39 PM
Hi,
We have a client that is always getting the "HTTP Error number:407" error.
This upload method is generally great and works for most of our clients except for just this one. Grrrrr!!!!
Does anyone know how to pass across data necesary for the Proxy-Authenticate/Proxy-Authorization using the cf_flashUpload?
Thanks,
Brad.
bryndon
385. bryndon wrote on July 09, 2009 at 2:09 PM
Well the upload works, and it definitely helps, but I just need to know how to attach those files to an email. I know how to do it with regular forms, but with flash forms, I have I have no idea.
Chris
386. Chris wrote on July 27, 2009 at 9:35 AM
This doesn't work for me in either IE7 or FF3.5 using Flash 10. Clicking "Browse" doesn't launch the browse window in any browsers. Very disappointing.
Randy
387. Randy wrote on July 27, 2009 at 11:17 AM
Works for me in FF 3.5.1, and my coworkers confirm IE 7 works for them. Sounds like you have internet gremlins
Chris
388. Chris wrote on July 27, 2009 at 12:28 PM
Realized the SWF was in the wrong place. Not much error notification there apparently.
Rob
389. Rob wrote on August 11, 2009 at 11:17 AM
Hey there, lovely site, and lots of great info! I've had luck working with some of the other modules, but for some reason, I just can't get this to work. The file upload process appears to complete, but the file never shows up. I've tried using the default file directory, as well as an absolute file path and an absolute web path. What am I missing?? Thanks.
ColdFusion Developer
Any chance you could post the FLA file? I didn't see it in the zip file.
Forrest Mahannah
391. Forrest Mahannah wrote on August 11, 2009 at 5:36 PM
I am trying to build the flash upload into a new ajax cold fusion app and cannot get the onComplete function to run anything that has to do with the new CF8 layout components.

Basically I want to have the flash uploader refresh a directory listing that is in a cflayoutarea. This requires the ColdFusion.navigate function to reload the layout and refresh the listings.

But the minute I include any reference to the ColdFusion.navigate function into a javascript function or even directly into the code where the onComplete function would actually execute, the flash upload refuses to load. You see the loading message and then a blank page, no errors in firebug or with cfdebuf, it just will not load.

I tested with a simple alert and oncomplete works fine.

I already tried using cfajaximport on every page used by the flash and it made no difference.

Has anyone been able to use the flash uploader in the new CF8 layout containers and called a coldfusion ajax function as part of the oncomplete?

Thanks for any help or ideas you might offer
Jason
392. Jason wrote on September 02, 2009 at 10:50 PM
Yes, the .FLA file would be great to start out with, if anyone could post or share a starter .fla file that would help. I'm not too familiar with integrating this stuff, and I've been messing around with some upload concepts using coldfusion, and PHP, and I haven't been successful in either method.

So far no luck getting the CFN files in the zip files to work, and hopefully the .fla file would get me started..... THANKS in advance
Jason
393. Jason wrote on September 05, 2009 at 12:16 AM
Ok, if the .fla file is what I've found posted, I"m still having trouble putting it all together.
Can someone put a series of steps on how to get started?
for example.
1) Download file A, file B, file C, from the postings
2) In the upload.cfm file change xxxx to link to your server
3) Any changes needed in the index.cfm file?
4) Do any of the files need to be un-commented to get some of the code to work?

Thanks in advance
Chris
394. Chris wrote on October 06, 2009 at 4:10 PM
_root.getURL seems to work incorrectly in Chrome. For me, it causes Flash to load the URL in some sort of frame within the Flash widget, instead of loading it in the browser window. Does this work for anyone in Chrome?
Jason
395. Jason wrote on October 08, 2009 at 7:34 PM
Any responses to my previous reply on post #393 on Sept 5th? Please check it out and if you know the answer, please respond :)
Chris
396. Chris wrote on October 08, 2009 at 8:23 PM
@Jason

It's not that complicated. Assuming you put the code in a web accessible directory that matches the paths it expects, it should just work. Use the working example as a reference.
Jason
397. Jason wrote on October 11, 2009 at 2:17 PM
I guess I'm a little confused, since the .swf file has nothing in it. I have tried to put it on my website, and still no luck. Any help would be appreciated, in some steps to take as mentioned in post 393

Thanks
Jason
398. Jason wrote on October 14, 2009 at 10:50 PM
Are there files beyond what is posted in the source files that need to be created, and if yes which ones? Does anyone have a set of well integrated files that could be run as is? Does a .fla file need to be created to call some of the coldfusion files? I'm still lost, help would be appreciated.
James
399. James wrote on October 26, 2009 at 7:39 PM
First of all, thank you for the code, it works great. I got everything working on my site.

I was wondering if there is a way to pass info to the upload page? Basically, a user uploads a file, I want that file to go to a specific folder based on the user. This is so I can store the location to the database and avoid users uploading content with the same name. So is there a way to pass the user name from the previous form?

Thanks in advance.
Lee
400. Lee wrote on November 04, 2009 at 12:13 PM
Is anyone else having problems with new Office 2007 files? the files are not opening up correctly. I just get page cannot be found.
cashmere sweaters
if you want to Find designer sweaters fitting the latest autumn/winter fashion trends online. welcome to sweatershow.com. at here, you can choose stylish sweaters. the latest fashion trends in sweaters: cashmere cardigans, turtleneck sweaters, wool crewneck sweaters, wintersoft v-neck sweaters.
James H.
402. James H. wrote on December 09, 2009 at 4:57 PM
Hello... I was having issues with some users on our intranet and trying to upload files. The file would appear to upload, but when it got to 100%, it prompted them with a username and password authentication box. Not all of our users, only a small percentage were having this issue. We lock down our intranet website and require AD Authentication.

I looked in this blog and saw quite a few people with the same issue, but no one had a solution and work-around. Well, I found a work-around and this is what I did...

I first thought it could be a browser/flash/computer issue, but one user could access and another couldn't on the same computer. So, I then I had the problem users try other computers and they were still having the same issue. So, I'm thinking it is something in the AD that is causing the problem. One of my problem users is a domain admin too.

To troubleshoot it a little more, I build a plain HTML form and had it post to upload.cfm. It worked just fine. Then tried and Flash Form and it didn't work.

I then checked the IIS logs and looked at what file the user was getting the 401 Error on. The logs showed the 401 Error on the upload.cfm file. So, I'm thinking that it has something to do with the flash form and upload.cfm.

What I did to fix our problem was to go into the server’s IIS Administrator, browse to the upload.cfm file, right clicked on upload.cfm, went to properties and enabled anonymous access just to the upload.cfm file. Problem solved.

I hope this helps anyone with the same problem.
Roger K.
403. Roger K. wrote on January 29, 2010 at 6:29 AM
Hello.
I have a question about the upload.cfm file.
the actions in the upload.cfm are:

1. Upload the file to the folder.

2. Resize the picture.

My question is is there a way to add more to the eventlistener. When the file is uploaded it will say 100% complete. this will stay there also during the resizing of the file. It just looks like it's all done but its in the process of resizing the picture.

<Upload picture>
Show text 100% of ....kb

<resizing picture>
Resizing the picture. please wait

thanks.
Bright
I need your help! I have a problem with the image upload and manipulation. I can only upload a form without an image i can upload an image on its own but not the two at once. I can't get the servername to the database. Please explain it to me us simply as possible.
Guxo
I have a problem...
I've just implemented a flash form based on this example on my web site because I needed a progress bar to be shown while uploding.
The progress bar apears but it shows 100% in 1 second independently of the file size, and then the upload takes place without any clue to the user of how long it will take.
Is this the way it suposed to work???
Grigory
The problem most likely related to anti virus software. Often they scan http traffic to improve user safety. Before scanning they buffered http request that is why you see 100% immediately. Many of our clients that had such problem have a Kaspersky Antivirus. To workaround described issue you need to add your site to anti virus trusted zone.

Hope this help.
Harkirat
407. Harkirat wrote on July 23, 2010 at 7:03 AM
Hi All,
I am having issues with the browse window not displaying when you click browse. I have tried all the suggesstions that were made e.g. make sure CFIDE/scripts directory is browser accessible, SWF file is in the correct location etc. I am on CF9, Flash 10 and IE8. Has anyone got this to work on that config? Any help would be greatly appreciated as I have spent countless hours now trying to resolve this and am at a deadend. I have used this a lot in my code and rewriting code would really be cumbersome for me at this point. Please heeellppp!

Harkirat
Harkirat
408. Harkirat wrote on July 23, 2010 at 8:17 AM
Just a follow up to my recent post. I figured out the issues on the CF9 server. I just didnt have the path to the swf file configured properly in the tag. However I still have issues with running it on one of the CF 8 servers which has annoyed me for a while. Its not critical though as it will soon be upgraded to CF9 so I don't require any help as of now. So all those wondering whether this works with CF9, Flash 10 and IE 8 the good news is that it does :).
Rick Justis
409. Rick Justis wrote on August 12, 2010 at 12:48 PM
I am having an issue with the flash where files above about 30 MB will give a 404 error but anything smaller than that works fine. any thoughts??
Omar
The application works great on the development server, once moved to the production, I get “movie not loaded”… I’m running CF 6 on the server. Any help would be much appreciated.
forumid
411. forumid wrote on December 04, 2010 at 9:47 PM
404 error. As Laura mentions at the top, "it means that the address you are sending the upload to does not exist or it cannot be found by the web server". In my case it was a difference between the development machine (localhost with WAMP) and the Windows server (live). I fixed this by modifying CFFILE in upload.cfm as shown below ("/" replaced with "\"). If I used "/" it seemed like the upload was successful, but nothing was uploaded.
<cffile action="UPLOAD" filefield="Filedata" destination="#expandpath('.')#\docs\" nameconflict="MAKEUNIQUE">
The uploaded file goes into a sub-folder called "docs".
Latooka
I am having an issue where once the 'upload' button is pressed, the progress status displays 'Upload Completed' however the file is not actually uploaded. To test my upload.cfm action I have tied a basic html file input to it and the file uploads as it should. Any help would be great.
Oliver
413. Oliver wrote on June 07, 2011 at 9:46 AM
Hello all,

Just download it recently and try it on both CF8 and CF9. As my testing environment is CF9, it works fine. When I put the stuff to my live machine which is running CF8, the Flash component didn't show up at all. Any clue on this.

I am running out of time to have this put up. Any suggestion would be much appreciated.

Thanks,
Oliver
Kvisoft
It's a headache for me to read the codes.
harkirat
415. harkirat wrote on January 12, 2012 at 12:05 PM
For those that are getting 404 errors while trying to upload files above 30 mb the reason is coz IIS has a default map upload limit set in the web server configuration file that defaults to 30 mb. That setting can be changed via the configuration editor in IIS. Directions are here
http://moodyconsumer.blogspot.com/2011/03/cffile-upload-with-iis-404-error.html

Leave your comment

Comment etiquette: As a gesture to those subscribed to this post, please keep your comments relevant to the post.

Your email address will never be displayed.
Email is gravatar enabled.Gravatar are the pictures you see next to the comments. If you like to have one, visit gravatar



Allowed tags:

<code>
All other tags will be shown as such, when in doubt, use the preview.

Leave this field empty:


Preview:

Refresh Preview
1. You wrote on