File Upload with ColdFusion Flash Forms
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
Joshua Dale
Steven Ross
Joshua Dale
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
Nahuel
Maybe you can submit a bug about this.
Joshua Dale
Joshua Dale
Trond Ulseth
M. Schopman
Doug Hughes
Thanks!
Joshua Dale
Joshua Dale
I don't seem to be able to get it to work otherwise.
spiraldev
Joshua Dale
Remember, google is our friend... ;o)
Laura
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
Thanks for the response though.
Trond Ulseth
You would hope so until you go into livedocs and read "this bug will be fixed in the next release"
... what exactly are you talking about. Will something be "taken away" from us?
Joshua Dale
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
Brian Sloan
Strange problem:
I am adding data to a table using remoting and I get the following error (from handler.onStatus): "Error while calling cfc: Service app.services.facade does not have a method addData that matches the name and parameters provided." 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
Brian Sloan
Laura
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
Michael Tyler
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.
Mic
me.
Rick
Nahuel
You need the Flash Player 8 to run this example
Nahuel
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
I am also find the solution on how to update the upload file. Do you have the solution on that?
thank you!
Joshua Dale
Michael
Thanks.
Paulo
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
Anyone have any ideas?
steve
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
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
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
NRR
Laura
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
Daniel Smith
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
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
Sorry! :)
Seth
Asher Gilbert
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
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
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 "unique" 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
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="false" 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
(Thanks much for the response earlier, too.)
George
nigel king
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!
Nahuel
Yes, this work on mac, but only on OSX.
Make sure that the machine has the latest player( 8 ) installed
Steve
// 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();
Luke Crawford
Nahuel
Drag and drop from the desktop to the browser is something that flash does not support yet.
Matt Gifford
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
Mode
Laura
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
Thanks
Noel
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)
Noel
I found the problem..
The 'Default CFFORM ScriptSrc Directory' in my MX7 & linux setup was set wrong!
After playing with it, I got it to work..
Shivang
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
Tony
Noel
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
>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
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
Laura
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
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
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
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
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.
Erik
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
Chris Albutt
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
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
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
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
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
So what is causing a pause every 64mb?
Coldfusion mx7 Enterprise (windows).
Firefox and IE
Thanks
Steve
Daz
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
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
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
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
Stuart
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
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
Nahuel
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
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
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
<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
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
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
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
todd
You may want to try one of these posts:
http://www.asfusion.com/blog/index.cfm?mode=entry&entry=1F1D08FE-3048-525A-B25E7A5D4D8EF256
http://www.asfusion.com/blog/entry/showing-an-image-after-upload
http://www.asfusion.com/blog/entry/thumbnails-in-cfgrid
They should help you out....
Nathbot
I never thought of using the "show image after upload" code to do this... I got pretty blind with my eyes glued to my own code. Ouch!
Thanks a lot Todd!
Jason
I'm glad it work for you! btw, which version of FB you using?
I'm in FB4.1 MVC
Matt
Don
Thanks guys
Don
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
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
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
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!
Antwain
Lamonte
Anny
Danny Young
Thanks,
Danny Young
Robert
Robert
Thanks again.
Robert
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
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
Thanks,
James
Eve
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
Thanks.
Steve
Giancarlo Gomez
Any input would be greatly appreciated.
JC
Dan
pat
colin
Don
Kiley
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
Thx!
Joey D
Joe D
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
Liam
vince
Thanks
Doug
Dale Wilson
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
Doug
todd
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
Laura
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
Jamie St. Pierre
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
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
<cf_flashUpload name="defaultFile" swf="_cf_templates/myForm/fileUpload.swf" actionFile="_cf_templates/myForm/upload.cfm">
<cf_flashUploadInput />
</cf_flashUpload>
todd
Can you explain that a little more? Why did you have to add _cf_templates to the path?
Todd
chad
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
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
Laura
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
Stas Newdel
Thanks!
Stas
Adam Dachis
Stas Newdel
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
Alec
like on CF 5, I got error:
Element SERVERFILE is undefined in CFFILE
joel
David
Thanks,
David
PS - LOVE THIS SITE!!!!!! :)
Neo
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
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
<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
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
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?
Peter
bill
I need to save file name in the database using remoting. How to get the file name saved on the server when nameconflict="makeunique"?
Thanks,
b.
David Adams
Nick
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 <form> 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 "upload complete" 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 "stop" 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
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)
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
Any thoughts or info would be appreciated.
Nick
So I'd suggest leaving the name parameter to its default. And then on the action page be sure to reference the file as "FileData" (filefield="Filedata")
Can't wait to get this thing into production!
Matthew Duffey
Thanks.
Matthew Duffey
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
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 <cfform type="flash"> 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
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
Kiley
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
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
From all the comments on this post I can't tell if I have an authentication issue or a directory permissions issue? Help?
Laura
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
Adam D
<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
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
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
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
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
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
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
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
There is not html code to show the flash forms?
Laura
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
Where do I must add the script of http://blog.oinam.com/archives/2005/08/flash-8-file-upload-download/ and what script?
Greg
Laura
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
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
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
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
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
Any ideas on this one....
Ed
Joseph Abenhaim
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
Thanks!
Aybee
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
<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
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
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
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
Any ideas?
Jon
Laura
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
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
Adam
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
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
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
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
yydoo
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
Greg
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
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
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
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
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
Never mind my previous comment, it worked, the email was just delayed. Thanks for a great app!
George Smith
Mark Kruger
Jason
HELP!
Thanks.
Bannai Umai
I demand it become so.
Laura
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
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
Growler
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
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
Thanks for the help!
DJ
Maggie
Todd
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
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
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
Rod
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
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
Dimitris.C.
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
Laura
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
This *is* an open source project... The complete source is available for download.
Rod
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
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
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
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
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
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
Jason
Jason
Jason
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
Marko
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
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
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
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
Also, I could pay a few money for this job. THANKS TO ALL!!!
Devon
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
files.cfm?FOLDER=#URL.FOLDER#
Thank you.. ANy help would be greatly appreciated..
Jeff
<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
please help
Alex
Alex S
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
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
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
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
Chung Lee
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
Any help would be wonderful.
Thanks,
Randy
Randy Taylor
Hope this helps others who run into the same problems.
Randy
Alex S
I have windows server 2003, what and where should i change to fix this problem?
thx
Randy Taylor
Thanks
Randy Taylor
Thanks
Tony B
Laura
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
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
Tony B
Ken F.
Tony B
Devon
Ken F
<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
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
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
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
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
<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
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
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
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
Ken F.
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.
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
Thanks...again, great job!
Devon
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
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.
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
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
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
how can i use multipule cf_flashUploadInput's with one
submit button on a cfform?
Greg
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
Dave
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
Greg
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
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
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
I use CF 8 Developer Edition on a windows 2003 server box with apache 2.2
Hint?
Harkirat Singh
Ben
Mark
Ken F.
Laura
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
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
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
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
Ed
scott
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
Harkirat Singh
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
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
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
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
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
Vadim
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
_root.getURL("http://www.website.com", "_self");
Good luck!
Vadim
John H.
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
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
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
or at very lease a create folder tutorial? I have all the rest down pat..
George
Malik
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
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
S. Jagan Langa
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
OH and the image recognition is really hard to get past. 5 attempts
David
David
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
Branden
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
index.cfm?action=uploadvideo
As this is a fusebox 1 structured application.
Branden
index.cfm?action=uploadvideo
As this is a fusebox 1 structured application.
Kris Kendrick
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
index.cfm?action=uploadvideo
As this is a fusebox 1 structured application.
Chris
jeremy
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
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
Any idea what is going on?
kalderm
any suggestion?
Thanks
kalderm
any suggestion?
Thanks
Antoine From France
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
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
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
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
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
Terry Bankert
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.
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
Lee
Lee
Terry Bankert
http://developer.yahoo.com/yui
Terry Bankert
http://developer.yahoo.com/yui
kanu kukreja
Muhammad
Asher
chris
chris
chris
Fermin
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
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
<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
Branden
Anthony
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
Barry Brunning
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
Alex Zinchenko
I'm using PHP and what to know is it possible to use your uploader with PHP.
Thank you.
Laura
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
<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
Neo
How to do ?
Thanks
Neo
Barry Brunning
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
In your browseScript code just add statements, not the function definition, like:
output.text = "Upload complete";
uploadBtn.enabled = false;
browseBtn.enabled = false;
Brad
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
Chris
Randy
Chris
Rob
ColdFusion Developer
Forrest Mahannah
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
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
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
Jason
Chris
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
Thanks
Jason
James
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
cashmere sweaters
James H.
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.
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
Guxo
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
Hope this help.
Harkirat
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
Rick Justis
Omar
forumid
<cffile action="UPLOAD" filefield="Filedata" destination="#expandpath('.')#\docs\" nameconflict="MAKEUNIQUE">
The uploaded file goes into a sub-folder called "docs".
Latooka
Oliver
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
harkirat
http://moodyconsumer.blogspot.com/2011/03/cffile-upload-with-iis-404-error.html