本文实例为大家分享了uploadify多图上传具体实现代码,可动态添加上传框,供大家参考,具体内容如下
<!DOCTYPE HTML>
<Meta http-equiv="Content-Type" content="text/html; charset=utf-8">
UploadiFive Test
';
Uploadify Demo
<a href="javascript:;" class="clickUpload"> 点击
<script type="text/javascript">
<?php $timestamp = time();?>
$(function() {
var i=2;
$('.clickUpload').click(function(){
var html='';
html+='<div class="file"><input id="file_upload'+i+'" name="file_upload" type="file" multiple="true">
$('.form_file').append(html);
$('#file_upload'+i).uploadify({
'formData' : {
'timestamp' : '<?php echo $timestamp;?>','token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},'swf' : 'uploadify.swf','uploader' : 'uploadify.php','width' : '120','fileTypeExts': '*.gif; *.jpg; *.png','buttonText': '上传图片','removeCompleted' : false,'multi' : true,//允许多图上传
//上传成功后执行
'onUploadSuccess': function (file,data,response) {
$('#' + file.id).find('.data').html(' 上传完毕');
}
});
i++;
})
$('#file_upload1').uploadify({
'formData' : {
'timestamp' : '<?php echo $timestamp;?>','token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},//允许多图上传
//上传成功后执行
'onUploadSuccess': function (file,response) {
$('#' + file.id).find('.data').html(' 上传完毕');
}
});
});