文件上传-jquery.uploadify.js

时间:2022-04-13 03:59:33
<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>