38 lines
962 B
HTML
38 lines
962 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title></title>
|
|
</head>
|
|
<body>
|
|
<input type="file" name="filename" id="upload-btn"/>
|
|
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
|
|
<script type="text/javascript">
|
|
$('#upload-btn').on('change', function (file) {
|
|
var file = $(this)[0].files[0];
|
|
var fileData = new FormData();
|
|
fileData.append("file", file);
|
|
|
|
var i = 0;
|
|
var func = function () {
|
|
if (i >= 2000) {return;}
|
|
|
|
$.ajax({
|
|
url: 'http://47.105.180.123:9503/upload',
|
|
data: fileData,
|
|
dataType: 'json', //服务器返回json格式数据
|
|
type: 'post', //HTTP请求类型
|
|
processData: false,
|
|
success: function () {
|
|
i++;
|
|
func();
|
|
}
|
|
})
|
|
};
|
|
|
|
func();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|