我有这个简单的代码拖放文件到网页,但它不工作!拖放区域应该改变背景颜色,当我拖动一个文件,但它没有!你能告诉我为什么吗?谢谢
<script src="~/Scripts/jquery.filedrop.js"></script>
<style type="text/css">
#dropZone {
background: gray;
border: black dashed 3px;
width: 1000px;
padding: 50px;
text-align: center;
color: white;
}
</style>
<script type="text/javascript">
$(function () {
$('#dropZone').filedrop({
url: '@Url.Action("UploadFiles")',
paramname: 'files',
maxFiles: 5,
dragOver: function () {
$('#dropZone').css('background', 'blue');
},
dragLeave: function () {
$('#dropZone').css('background', 'gray');
},
drop: function () {
$('#dropZone').css('background', 'gray');
},
afterAll: function () {
$('#dropZone').html('The file(s) have been uploaded successfully!');
},
uploadFinished: function (i, file, response, time) {
$('#uploadResult').append('<li>' + file.name + '</li>');
}
});
});
</script>
<h2>File Drag & Drop Upload</h2>
<div id="dropZone">Drop your files here</div>
<br>
Uploaded Files:
<ul id="uploadResult">
</ul>
1条答案
按热度按时间ppcbkaq51#
您应该添加
Fallback_id
类似下面的东西:
此
fallback_id
是输入type=file
的ID