【发布时间】:2013-08-06 13:30:24
【问题描述】:
我有文件上传和一些输入文本,我想使用 WCF 将值更新到 DB。
到目前为止,我通过字符串数组发送所有输入值,但我看不到如何使用 WCF 将文件上传到服务器
html:
<input id="file" type="file" >
<textarea name="textarea" class="jqte"> </textarea>
...
javascript:
$.ajax({
url: "/WebServices/forum.svc/InsertMessage",
type: "POST",
data: JSON.stringify({ currentMessage: currentMessage }),
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (data) {
}
});
WCF:
[OperationContract]
public void InsertMessage(List<string> currentMessage)
{
return;
}
知道如何解决这个问题吗?
谢谢
巴罗兹
【问题讨论】:
-
使用 uplick.js ......它让你的任务超级简单......我犯了同样的错误,通过 ajax 发送文件......我失败了......使用 iframe 或一些 js ......这可能会有所帮助..只需 google js 用于文件上传..有大量 js 可用..
标签: c# javascript asp.net wcf