jquery插件uploadify多图上传功能实现代码
本文实例为大家分享了uploadify多图上传具体实现代码,可动态添加上传框,供大家参考,具体内容如下
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>UploadiFive Test</title> <script src="jquery2.js" type="text/javascript"></script> <script src="jquery.uploadify.min.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="uploadify.css"> <style type="text/css"> body { font: 13px Arial, Helvetica, Sans-serif; } </style> </head> <body> <h1>Uploadify Demo</h1> <div class='upload'> <form> <div class='form_file'> <div class='file'> <input id="file_upload1" name="file_upload" type="file" multiple="true"> </div> </div> </form> </div> <a href="javascript:;" class="clickUpload"> 点击 </a> <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"></div>'; $('.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);?>' }, '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(' 上传完毕'); } }); }); </script> </body> </html>
更多精彩内容,请点击《jQuery上传操作汇总》,进行深入学习和研究。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持安科网。
相关推荐
clayluo 2017-06-05
xcguoyu 2014-01-18
中等偏下 2015-04-14
yanyiping 2015-06-03
zfjdoreen 2015-08-24
selt 2017-09-28
梦回forever 2012-03-21
xxglh 2012-01-06
changsongzi 2013-02-20
中等偏下 2017-09-28
玫瑰余香000 2017-06-05
luochaotj 2015-08-26
88403861 2015-08-24
luyou0 2015-06-04
83457317 2015-06-03
中等偏下 2015-05-07
selt 2015-04-14
懒猫猫IT 2015-01-26
苗疆三刀的随手记 2014-11-18