AJAX Upload + Coldfusion

自闭症网瘾萝莉.ら 提交于 2019-12-10 21:27:27

问题


I'm using the following JQUERY Plug-in to upload ideas:

http://valums.com/ajax-upload/

For some reason I'm getting the following error:

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

Even though the plug-in code has it:

var form = qq.toElement('<form method="post" enctype="multipart/form-data"></form>');

Any ideas what the issue could be?


回答1:


It happens because Safari4 and Chrome5 doesn't allow to format xhr request the same way as normal form based upload.

You will need to get the raw post data and write it to the file, when normal way of getting the file is not available.

and return {"success":true}

or in case of error {"error":"error message to display"}

There is a function in Coldfusion called GetHttpRequestData which may help, but I'm not sure, since I never used Coldfusion myself.

http://www.adobe.com/livedocs/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000482.htm


If this will be too difficult, I'm planning to add an option to send a file similar way as the previous versions did, but this works perfectly only in Safari5, Chrome6 and latest FF, the users of other browsers will have the same experience as the IE users.

Meanwhile you can use the previous version http://github.com/valums/ajax-upload




回答2:


Did you intentionally leave out the action tag? Perhaps you can show the CFM handling the file upload as well.



来源:https://stackoverflow.com/questions/3327014/ajax-upload-coldfusion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!