zoukankan      html  css  js  c++  java
  • java--uploadify3.1多文件上传

    使用uploadify时,建议下载uploadify3.1文档。边做边看。

     这是页面端:

                        <label  style="color:#15428B;font-weight:bold;">选择文件:</label>
                        <fieldset style="300px;height:33px;border:1px solid #99BBE8;text-align:left;COLOR:#000000;FONT-SIZE:12px;font-family: Verdana;padding:5px;">                
                            <input name="actpic" type="file" id="actpic" />
                        </fieldset>

    在页面上写上相应的js方法:

    $('#actpic').uploadify('upload','*');

    用上面的方法调用下面的

    <script type="text/javascript">
        $(function () {
            $('#actpic').uploadify({
                'debug'             : false,                             
                'auto'             : false,                            
                'multi'             : true,    
                'uploader'          : 'admin/uploadyear.action', 
                'fileObjName'     : 'actpic',                      
                'removeCompleted': false,                            
                'progressData'     : 'percentage',                     
                'buttonText'     : '附件上传',                     
                'formData'         :{'getyearid':${getyearid},'yearReportType':'1','statisform_obj_id':${(statistical_form_name[0][0])?default('0')},'statistical_form_name3':'1','remark_name':'1','other_tagsname':'1','idStr':'1'},
                'fileTypeDesc'   : 'Any Old file you want',
                'method'         : 'post',    
                'cancel'         : 'uploadify/uploadify-cancel.png',
                'fileSizeLimit'     : '50MB',                           
                'swf'             : 'uploadify/uploadify.swf',                 
                'width'             : 300,
                'onUploadStart'  :function(file){
                       // alert(file.name);
                    //获取数据
                    //var statistical_form_name3 = $("#statistical_form_name3").val();
                    var other_tagsname = $("#other_tagsname").val();
                    var remark_name = $("#remark_name").val();
                    var yearReportType = $("#yearReportType").val();
                    //alert(statistical_form_name3);
                    //alert(other_tagsname);
                    alert(yearReportType);
                    // 以下是得到选中的复选框
                    var ids = new Array();
                    var idStr;
                    //if ($("input[name='tagsname']:checked").size() == 0) {
                    //    alert("请选择需要检索的标签!");
                    //    return false;
                    //}
                    $("input[name='tagsname']:checked").each(function(i, obj) {
                        ids[i] = $(obj).val();
                    });
                    if(ids!=null){
                        idStr = ids.join("-");
                    }
                     
                    //alert(idStr+"ww");
                    
                    $('#actpic').uploadify("settings","formData",{'idStr':idStr,'statistical_form_name3':file.name,'yearReportType':yearReportType,'other_tagsname':other_tagsname,'remark_name':remark_name});
                },
                      <#--全部文件上传完触发(将信息进行发送)-->
                 'onQueueComplete' : function(queueData) {
                     $.pdialog.closeCurrent();
                     alert("上传成功");
                     navTab.reload("admin/yearreportList.action", {}, "yearreportList");
                 }
                
            });
        });
    </script>

    我这里是用struts2 的框架 在配上有些传送数据。

    不懂可以提,版主一直在,共同进步

  • 相关阅读:
    [杂说]网络是基础生产工具
    这几天的工作
    [代码]大家来动动脑筋吧
    测试
    [基础] 如何使用extern和static限定符
    元宵节快乐
    复杂的“人"
    C# SMTP发邮件不支持465端口的解决方案,网易企业邮箱
    软件三层架构模型
    ASP.NET MVC 使用二级域名来注册Area区域
  • 原文地址:https://www.cnblogs.com/Alandre/p/3205719.html
Copyright © 2011-2022 走看看