uploadify 3.2.1是 jQuery提供的一个上传插件,其参数详解见 http://www.cnblogs.com/yangy608/p/3915349.html
这里列举一个实际应用的例子:其实是摘自onethink的一段代码,关靠参数,没有实际例子,对于我等初学者实为不利
<script type="text/javascript" src="/uploadify/jquery.min.js"></script> <script type="text/javascript" src="/uploadify/jquery.uploadify.min.js"></script> <input type="file" id="upload_picture_{$field.name}"> <input type="hidden" name="{$field.name}" id="cover_id_{$field.name}" value="{$data[$field['name']]}"/> <div class="upload-img-box"> <div class="upload-pre-item"><img src="{$data[$field['name']]|get_cover='path'}"/></div> </div> <script type="text/javascript"> //上传图片 /* 初始化上传插件 */ $("#upload_picture_{$field.name}").uploadify({ "height" : 30, "swf" : "__STATIC__/uploadify/uploadify.swf", "fileObjName" : "download", "buttonText" : "上传图片", "uploader" : "{:U('File/uploadPicture',array('session_id'=>session_id()))}", "width" : 120, 'removeTimeout' : 1, 'fileTypeExts' : '*.jpg; *.png; *.gif;', "onUploadSuccess" : uploadPicture{$field.name}, 'onFallback' : function() { alert('未检测到兼容版本的Flash.'); } }); function uploadPicture{$field.name}(file, data){ var data = $.parseJSON(data); var src = ''; if(data.status){ $("#cover_id_{$field.name}").val(data.id); src = data.url || '__ROOT__' + data.path $("#cover_id_{$field.name}").parent().find('.upload-img-box').html( '<div class="upload-pre-item"><img src="' + src + '"/></div>' ); } else { updateAlert(data.info); setTimeout(function(){ $('#top-alert').find('button').click(); $(that).removeClass('disabled').prop('disabled',false); },1500); } } </script>