'<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"
type="text/javascript"></script>
$('#file_upload').uploadify({
'swf'
:
'uploadify/uploadify.swf',
'uploader' :
'uploadify/uploadify.php',
'buttonText':'添加附件',
'queueID':
'queue',
'width' :
80,
'height' :
15,
'fileSizeLimit' : '2MB', //限制上传的文件大小
'queueSizeLimit':5,
'fileTypeExts' : '*.jpg;*.gif;*.png;*.jpeg',
//允许的格式
'onUploadProgress' : function () {
$('#xxx').html('上传中...');
},
'onUploadSuccess' : function(file,data,response) {
//
alert("文件:" + "["+file.name +"]"+ "上传成功");
if(data == 'Notype'){
alert('上传格式错误!');return;
}
$('#xxx').html('上传成功!');
//alert(data);
},
'onUploadError' : function(file,errorCode, errorMsg,errorString)
{
alert('文件'+ file.name+
'上传失败');
}
});
<script src="jquery.uploadify.min.js"
type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
href="uploadify.css">'$(function() {
});
本文介绍如何利用jQuery Uploadify插件实现网页文件上传功能。文中详细配置了Uploadify的各项参数,包括文件大小限制、文件类型限制及上传进度提示等,并提供了基本的上传成功与失败的回调处理。
4816

被折叠的 条评论
为什么被折叠?



