123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
- <title>测试</title>
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
- <link rel="stylesheet" type="text/css" href="/nwyj/scripts/jquery/jqueryUi/jquery-ui.css" />
- <script type="text/javascript" src="/nwyj/scripts/jquery/jqueryUi/jquery-ui.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/webUploader/webuploader.js"></script>
-
-
- </head>
- <body >
- <div>
- <input type='hidden' name ='uploaderFileRealName' id = 'uploaderFileRealName'/>
- <input type='hidden' name ='uploaderFileName' id = 'uploaderFileName'/>
- <input type='hidden' name ='uploaderFileExt' id = 'uploaderFileExt'/>
- <div id="picker">选择文件</div>
-
- <div id="progressbar" style="width:200px"></div>
- <script type="text/javascript" >
- // 图片上传demo
- jQuery(function() {
-
- $("#progressbar").progressbar({
- value: 0
- });
- var uploader;
- // 初始化Web Uploader
- uploader = WebUploader.create({
- // 自动上传。
- auto: true,
- // swf文件路径
- swf: '/nwyj/scripts/webUploader/Uploader.swf',
- // 文件接收服务端。
- server: '/nwyj/Upload',
- // 选择文件的按钮。可选。
- // 内部根据当前运行是创建,可能是input元素,也可能是flash.
- pick: '#picker'
- });
-
- // 当有文件添加进来的时候
- uploader.on( 'fileQueued', function( file ) {
- });
- // 文件上传过程中创建进度条实时显示。
- uploader.on('uploadProgress', function( file, percentage ) {
- $( "#progressbar" ).progressbar( "value", percentage * 100 );
- });
- // 文件上传成功,给item添加成功class, 用样式标记上传成功。
- uploader.on( 'uploadSuccess', function( file ) {
- });
- // 文件上传失败,现实上传出错。
- uploader.on( 'uploadError', function( file ) {
- });
- // 完成上传完了,成功或者失败,先删除进度条。
- uploader.on( 'uploadComplete', function( file ) {
- });
- });
- </script>
- </body>
- </html>
|