本文介绍了AJAX上传+ Coldfusion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下JQUERY插件上传创意:

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

由于某种原因,我收到以下错误: / p>

For some reason I'm getting the following error:

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

即使插件代码具有:

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 wayof getting the file is not available.

并返回{成功:true}

and return {"success":true}

或出现错误{error:要显示的错误消息}

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

在Coldfusion中有一个名为GetHttpRequestData的函数,它可以帮助
,但是我不确定,因为我从来没有使用过Coldfusion。

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

如果这将太困难,我打算添加一个选项发送一个
文件类似于以前的版本,但这工作
完美只在Safari5,Chrome6和最新FF,其他
浏览器的用户将有与IE用户相同的体验。

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

同时,您可以使用旧版

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

这篇关于AJAX上传+ Coldfusion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 13:45