jqurey上传库地址http://www.jq22.com/jquery-info103
效果如下:
使用方式与官网介绍的相差不多
主要的文件包括
1.jquery.uploadify.js
2.jquery.uploadify.min.js
3.jquery-1.7.2.min.js
4.uploadify.css
5.uploadify.swf
6.uploadify-cancel.png
引用js和样式
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script src="jquery.uploadify.js" type="text/javascript"></script>
<script src="jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="uploadify.css">
web页面添加控件
<input type="file" name="file_upload" id="file_upload"/>
js调用
$(function() {
$('#file_upload').uploadify({
'swf' : 'uploadify.swf',
'uploader' : 'uploadify.php'
// Put your options here
});
});
关于 put your options here 部分,可以添加的内容,我们可以在
jquery.uploadify.js中查找
特别注意限制文件大小可以用fileSizeLimit来标注大小1M = 1024,大家根据需要限制,同时,控件本身支持无限上传,但是服务器上传有限制需要在
web.config的
<httpRuntime maxRequestLength="888888888" executionTimeout="50000" />
具体长度可以随意设置,本例设置为888888888,还有超时时间。