Re: CFFILE and Ajax file uploads
This is the solution in Prototype. Original concept provided by Ben Nadel and translated to Prototype by Mahesh --- index.htm - script type=text/javascript src=prototype-1.6.0.2.js/script script type=text/javascript Event.observe(window, 'load', function(){ Event.observe('file_upload', 'change', function(){ $('form').writeAttribute({enctype:multipart/form-data, method:post, action:cffile.cfm, target:RSIFrame}); $('form').insert(new Element(iframe, {id: RSIFrame, name: RSIFrame, style: width: 0px; height: 0px; border: 0px;, src: blank.html})); $('form').submit(); }); }); function showResult(result){ $('file_upload').remove(); $('upload_update').insert(new Element(a, {href: http://localhost/upload/; + result}).update(Uploaded Image)); } /script form id=form input name=file_upload id=file_upload type=file size=60 / span id=upload_update/span /form For the above script to work across browsers, do not set the form enctype in the prototype writeAttribute, instead add it to the form, as IE will not do the upload, if the form is set with the encType through JS. - ---end--- cffile.cfm--- - cffile action=upload filefield=file_upload destination=d:/inetpub/wwwroot/ nameconflict=MAKEUNIQUE script type=text/javascript cfoutput window.parent.showResult('#file.serverfile#'); alert('#file.serverfile#'); /cfoutput /script - ---end--- ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312765 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
CFFILE and Ajax file uploads
Hi all, So I did some googling and searched through the threads here as well. I'm not finding what I need to know. What I'm trying to do: Upload a file to the server via ajax and an iFrame using the tool from: (http://www.webtoolkit.info/ajax-file-upload.html) I've got the code in a test file, and can get the form var in the receiving (cfm) page to output the file var (it results in a path to the file I choose) but it won't upload. Any ideas? Anyone using this and getting it to work? I've zipped my files and posted them here (http://www.cflhd.gov/cffileajax.zip) for you to look at. The code from the AIM toolkit is unchanged except the form tag, I played around with that a bit. CHANGES: added enctype - none prior renamed the file input from 'form[file]' to FILE_LOC changed action to cffile.cfm Really I just need to know what the CFILE tag is expecting. I've used it no problem in the past, but I think I'm not quite understanding something here. (Oh, I know there are sofware packages I can buy and flash solutions.. I don't want either. This is govt...) Thanks for your time and effort. Brent ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312713 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: CFFILE and Ajax file uploads
I used this jQuery plugin http://www.phpletter.com/Demo/AjaxFileUpload-Demo/ On Thu, Sep 18, 2008 at 5:02 AM, Brent Nicholas [EMAIL PROTECTED]wrote: Hi all, So I did some googling and searched through the threads here as well. I'm not finding what I need to know. What I'm trying to do: Upload a file to the server via ajax and an iFrame using the tool from: ( http://www.webtoolkit.info/ajax-file-upload.html) I've got the code in a test file, and can get the form var in the receiving (cfm) page to output the file var (it results in a path to the file I choose) but it won't upload. Any ideas? Anyone using this and getting it to work? I've zipped my files and posted them here ( http://www.cflhd.gov/cffileajax.zip) for you to look at. The code from the AIM toolkit is unchanged except the form tag, I played around with that a bit. CHANGES: added enctype - none prior renamed the file input from 'form[file]' to FILE_LOC changed action to cffile.cfm Really I just need to know what the CFILE tag is expecting. I've used it no problem in the past, but I think I'm not quite understanding something here. (Oh, I know there are sofware packages I can buy and flash solutions.. I don't want either. This is govt...) Thanks for your time and effort. Brent ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312732 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: CFFILE and Ajax file uploads
Dojo has a /pimp/ file upload deal-- it'll even do the flash multi-file one that degrades into a normal AJAX file upload thingie. That toolkit just freaking rocks. Dunno if the problem is with the toolkit tho... sounds like it's one of the I can't believe I forgot /that/ type deals, like I had the other night. Freaking hours, and I hadn't set the content-type right. Bah! -- The poor are prevented from thinking by the discipline of others, the rich by their own. Theodor Adorno On Wed, Sep 17, 2008 at 6:52 PM, AJ Mercer wrote: I used this jQuery plugin http://www.phpletter.com/Demo/AjaxFileUpload-Demo/ On Thu, Sep 18, 2008 at 5:02 AM, Brent Nicholas [EMAIL PROTECTED]wrote: Hi all, So I did some googling and searched through the threads here as well. I'm not finding what I need to know. What I'm trying to do: Upload a file to the server via ajax and an iFrame using the tool from: ( http://www.webtoolkit.info/ajax-file-upload.html) I've got the code in a test file, and can get the form var in the receiving (cfm) page to output the file var (it results in a path to the file I choose) but it won't upload. Any ideas? Anyone using this and getting it to work? I've zipped my files and posted them here ( http://www.cflhd.gov/cffileajax.zip) for you to look at. The code from the AIM toolkit is unchanged except the form tag, I played around with that a bit. CHANGES: added enctype - none prior renamed the file input from 'form[file]' to FILE_LOC changed action to cffile.cfm Really I just need to know what the CFILE tag is expecting. I've used it no problem in the past, but I think I'm not quite understanding something here. (Oh, I know there are sofware packages I can buy and flash solutions.. I don't want either. This is govt...) Thanks for your time and effort. Brent ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312742 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: CFFILE and Ajax file uploads
I should note that the flash multi-file upload stuff doesn't look like it will work with flash player 10, IIRC. The real solution is to pressure the browsers, as came up in Rick's thread. -- The recent past always presents itself as if destroyed by catastrophes. Theodor Adorno On Wed, Sep 17, 2008 at 11:04 PM, denstar wrote: Dojo has a /pimp/ file upload deal-- it'll even do the flash multi-file one that degrades into a normal AJAX file upload thingie. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312746 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4