81,092
社区成员
发帖
与我相关
我的任务
分享
@Controller
@RequestMapping("/fck")
public class FckImportWordController
{
@Autowired
SiteInfoDao siteInfoDao;
@RequestMapping(value = "/importWord.gp", method = RequestMethod.POST)
public void importWord(HttpServletRequest request, HttpServletResponse response, String filedata) throws IOException
{
。。。
}
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Code Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="ajaxfileupload.js"></script>
<script type="text/javascript" src="importword.js"></script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<table height="100%" width="95%" align="center">
<tr height="40">
<td>
<input type="file" name="filedata" id="filedata">
<input type="button" id="refer" value="导入" />
</td>
</tr>
</table>
</body>
</html>
var oEditor = window.parent.InnerDialogLoaded();
var FCKLang = oEditor.FCKLang;
var FCKCodes = oEditor.FCKCodes;
oEditor.FCKLanguageManager.TranslatePage(document);
$(document).ready(function()
{
$("#refer").click(function()
{
alert("上传");
$.ajaxFileUpload(
{
url : "../fck/importWord.gp",
secureuri : false,
fileElementId : 'filedata',
dataType : 'text',
success : function(data, status)
{
if (typeof data != undefined)
{
if (data == "e")
{
alert("类型错误,只能是word类型的!");
}
else if(data == "kong")
{
alert("请选择Word文件!");
}
else
{
oEditor.FCK.InsertHtml(data);
window.parent.Cancel(true);
}
}
},
error : function(data, status, e)
{
alert("error" + status);
}
});
});
});