AJAX上传+ ColdFusion的上传、AJAX、ColdFusion

2023-09-10 19:40:20 作者:怂了丶

我用下面的jQuery插件上传思路:

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".

尽管插件code有它:

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?

推荐答案

这是因为Safari4和Chrome5不允许格式化XHR请求的方式一样正常形态为主的上传。

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.

和返回{成功:真}

或在案件{错误:错误信息,显示}错误

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

有一个在ColdFusion中函数调用GetHtt prequestData这可能会有帮助, 但我不知道,因为我从来没有使用过Coldfusion的自己。

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

如果这将是太困难了,我打算增加一个选项发送 文件类似的方式为previous版本做了,但是这个工程 完美只在Safari5,Chrome6和最新的FF,其他的用户 浏览器都会有相同的体验为IE用户。

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.

同时,你可以使用previous版本 http://github.com/valums/ajax-upload

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