文件上传-jquery.uploadify.js

<script type="text/javascript" src="../jquery_uploadify/jquery.uploadify-3.1.min.js"></script>
 <link type="text/css" rel="stylesheet" href="../jquery_uploadify/uploadify.css"/>
    
    
    <script type="text/javascript">
    
            $(function() {
                $("#uploadFile").uploadify({
                     'swf':'../jquery_uploadify/uploadify.swf',
                      'cancelImg': '../jquery_uploadify/uploadify-cancel.png',
                      'uploader':'${ctx}/data/saveUploadFile.do?zybid=${zyb.id}',
                      //'formData':{'zybid':'${zyb.id }'}, 
                      fileObjName:'uploadFile',
                      'method':'post',
                       height        : 20,
                       width         : 60,
                       'auto': false,
                      'fileSizeLimit':'10MB',
                      'fileTypeExts':'*.xls',
                      'fileTypeDesc':'请上传xls文件',
                      'multi':false,
                      //'queueSizeLimit': 25, 
                      'buttonText':'选择文件',
                      'onSelect': function(file) {
                              
                          },
                          'onUploadStart':function(file){
                          
                          },
                          'onUploadProgress' : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {
                             
                            },
                          'onUploadError': function() {
                              $.messager.alert('上传失败!表格式出现异常');
                          },
                          'onUploadSuccess': function(file,data,respone){
                              doSomething();
                          }
                      
                      
                      
                      
                });
               
            });



function submitFile(){
//$('#fileForm').submit();
$('#uploadFile').uploadify('upload');
}


  </script>

<body>
   <input type="file" name="uploadFile" id="uploadFile">

 </body>

  

 

posted @ 2017-05-27 11:43  伍叶春  阅读(1252)  评论(0编辑  收藏  举报