我正在配置 blueimp 以在点击发布按钮时上传图片。我的问题是它没有调用该$('#fileupload').fileupload
函数。我已包含以下 javascript 文件。以下是我的代码,请看看是什么问题。
<head>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui.js"></script>
<script type="text/javascript" src="../../js/jQuery-File-Upload-master/js/jquery.fileupload.js"></script>
<script type="text/javascript" src="../../js/jQuery-File-Upload-master/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../js/jQuery-File-Upload-master/js/jquery.iframe-transport.js"></script>
<script type="text/javascript">
$('#fileupload').fileupload({
dataType : 'json',
url : "ownmessages",
add: function (e, data) {
$('#post') .click(function () {
$('#post').text('Uploading...');
data.submit();
});
},
done: function (e, data) {
$('#post').text('Upload finished.');
}
});
</script>
</head>
<body>
<s:form action="ownmessages" enctype="multipart/form-data" method="post">
<s:textarea rows="2" cols="40" name="message" id="message1"></s:textarea><br>
<s:select name="msg_visibility" id="msg_visibility" list="#{'public':'Public', 'friends':'Friends','me':'Me only'}" value="public"/>
<input id="fileupload" type="file" name="user_post_image[]" data-url="ownmessages"/>
<input type="button" value="Post" id="post" />
</s:form>
</body>