使用fileuploader.js实现文件上传

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTDXHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"content="text/html; charset=utf-8" />
<title>file uploader</title>
<script type="text/javascript"src="./js/fileuploader.js"></script>
<link rel="stylesheet"type="text/css" href="./css/fileuploader.css"/>
<script type="text/javascript">
window.onload = function() {
new qq.FileUploader({
element:document.getElementById("uploader"),
action: 'upload',
debug:true,
allowedExtensions:['jpg'],
sizeLimit: 819200, //800k
messages: {
typeError: "文件错误:只允许{extensions}类型的文件。{file}. ",
sizeError: "文件错误:文件大小不能超过{sizeLimit}字节。{file}.",
emptyError: "文件错误:不能上传空文件。{file}.",
onLeave: "文件正在上传,离开将终止上传操作?"
},
showMessage: function(message){
alert(message);
}
});
}
</script>
</head>

<body>
<div id="uploader">
<noscript><p>改浏览器不支持javascript!</p></noscript>
</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值