当前位置:编程学习 > JAVA >>

【求struts2上传实时进度条】

求struts2上传实时进度条,只用struts2兼ajax或dwr的,不要其他框架的。。。哪位大侠有的话请不要吝啬给我一个,或是上传到资源里 我去下载啊。。先谢谢啦。。。。我研究了2,3天了还是没有弄好用。真的很繁琐啊。。 --------------------编程问答-------------------- 确实很烦。我也想要 --------------------编程问答-------------------- 留个记号,为嘛不用其他框架? --------------------编程问答-------------------- 这是一个值得研究的问题,那位大侠会的话也告诉我一下,谢了! --------------------编程问答--------------------
引用 2 楼 curacfyh 的回复:
留个记号,为嘛不用其他框架?
集合的技术少了才好兼容嘛。我写的只是个demo,因为我项目中好多地方要用到,到时候只用这一个就ok啦, --------------------编程问答-------------------- 快来人啊,,,,高手大牛们来帮忙啊。。。 --------------------编程问答-------------------- 我有例子。。让我好好找找 --------------------编程问答-------------------- 干什么不用js呢? --------------------编程问答--------------------
引用 7 楼 melovevc 的回复:
干什么不用js呢?
js? 不是要那个假的效果。。。我是要实时监控的。。。 --------------------编程问答--------------------
引用 6 楼 gabriel80 的回复:
我有例子。。让我好好找找
 好啊 好啊 。。。。 --------------------编程问答-------------------- 帮顶.......... --------------------编程问答-------------------- 帮顶一下 --------------------编程问答-------------------- 看下这个http://blog.csdn.net/garryyrc/archive/2010/04/18/5499113.aspx --------------------编程问答-------------------- 我有用servlet +jquery 做的实时上传。
用的fileupload.组件 。 --------------------编程问答--------------------
引用 12 楼 pixiaozheng 的回复:
看下这个http://blog.csdn.net/garryyrc/archive/2010/04/18/5499113.aspx
看过了 但是还是没有弄好。。。很烦。。。 --------------------编程问答-------------------- 那个确实比较麻烦。。还得去下载一个springside。。

这个比较简单一点。。你看看。。
http://blog.sina.com.cn/s/blog_674b23220100he8x.html --------------------编程问答--------------------
引用 15 楼 pixiaozheng 的回复:
那个确实比较麻烦。。还得去下载一个springside。。
这个比较简单一点。。你看看。。
http://blog.sina.com.cn/s/blog_674b23220100he8x.html
很晕,,我这上不了其他的网。。。看不了。。。 --------------------编程问答--------------------
引用 16 楼 ladybirds2008 的回复:
引用 15 楼 pixiaozheng 的回复:
那个确实比较麻烦。。还得去下载一个springside。。
这个比较简单一点。。你看看。。
http://blog.sina.com.cn/s/blog_674b23220100he8x.html
很晕,,我这上不了其他的网。。。看不了。。。


全文在此,我也留一份:

最近在做一个资源共享的项目中,采用了Struts2.1.8+Spring2.5.6+hibernate3.32的框架整合方式进行开发。在文件上传这块,因为需要实现文件上传时显示进度条的功能,所以尝试了一下。怕以后忘记,先贴出来分享下。

   要在上传文件时能显示进度条,首先需要实时的获知web服务端接收了多少字节,以及文件总大小,这里我们在页面上使用AJAX技术每一秒向服务器发送一次请求来获得需要的实时上传信息。但是当我们使用struts2后怎么在服务端获得实时的上传大小呢?这里需要用到commons-fileupload中的progressListener接口,实现这个接口,然后再实现一个自己的解析器,并在解析器中添加自己实现的那个 progressListener;然后再替换struts2自带的解析器(struts2自带的解析器类没有添加progressListener),然后就可以了。下面看看主要的代码(技术有限,如有不对之处,望不吝点解):

 

监听器:

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpSession;

import org.apache.commons.fileupload.ProgressListener;

 

public class ResourceProgressListener implements ProgressListener {

    private HttpSession session;

 

    public ResourceProgressListener(HttpServletRequest request) {

       session = request.getSession();

       ResourceFileUploadStatus newUploadStatus = new ResourceFileUploadStatus();

       session.setAttribute("currentUploadStatus", newUploadStatus);

    }

 

    public void update(long readedBytes, long totalBytes, int currentItem) {

       ResourceFileUploadStatus status = (ResourceFileUploadStatus) session.getAttribute("currentUploadStatus");

       status.setReadedBytes(readedBytes);

       status.setTotalBytes(totalBytes);

       status.setCurrentItem(currentItem);

    }

}

上传状态类:

public class ResourceFileUploadStatus {

    private long readedBytes = 0L;

    private long totalBytes = 0L;

    private int currentItem = 0;

   

    public long getReadedBytes() {

       return readedBytes;

    }

    public void setReadedBytes(long bytes) {

       readedBytes = bytes;

    }

    public long getTotalBytes() {

       return totalBytes;

    }

    public void setTotalBytes(long bytes) {

       totalBytes = bytes;

    }

    public int getCurrentItem() {

       return currentItem;

    }

    public void setCurrentItem(int item) {

       currentItem = item;

    }

}

实现自己的解析器类:方法比较简单,找到struts2实现的解析器类,把代码拷贝过来然后添加上监听器即可。这个类代码较多就不整个文件拷了,主要是在parse方法里添加。Parse方法代码如下:红色标注部分即是需要自己添加的progressListener.

public void parse(HttpServletRequest servletRequest, String saveDir)

            throws IOException {

    System.out.println("执行自定义MultiPartRequest");

        DiskFileItemFactory fac = new DiskFileItemFactory();

        // Make sure that the data is written to file

        fac.setSizeThreshold(0);

        if (saveDir != null) {

            fac.setRepository(new File(saveDir));

        }

 

        // Parse the request

        try {

            ServletFileUpload upload = new ServletFileUpload(fac);

            upload.setSizeMax(maxSize);

          

            ResourceProgressListener progressListener = new ResourceProgressListener(servletRequest);//新建一个监听器

            upload.setProgressListener(progressListener);//添加自己的监听器

           

            List items = upload.parseRequest(createRequestContext(servletRequest));

 

            for (Object item1 : items) {

                FileItem item = (FileItem) item1;

                if (LOG.isDebugEnabled()) LOG.debug("Found item " + item.getFieldName());

                if (item.isFormField()) {

                    LOG.debug("Item is a normal form field");

                    List<String> values;

                    if (params.get(item.getFieldName()) != null) {

                        values = params.get(item.getFieldName());

                    } else {

                        values = new ArrayList<String>();

                    }

                    String charset = servletRequest.getCharacterEncoding();

                    if (charset != null) {

                        values.add(item.getString(charset));

                    } else {

                        values.add(item.getString());

                    }

                    params.put(item.getFieldName(), values);

                } else {

                    LOG.debug("Item is a file upload");

 

                    // Skip file uploads that don't have a file name - meaning that no file was selected.

                    if (item.getName() == null || item.getName().trim().length() < 1) {

                        LOG.debug("No file has been uploaded for the field: " + item.getFieldName());

                        continue;

                    }

 

                    List<FileItem> values;

                    if (files.get(item.getFieldName()) != null) {

                        values = files.get(item.getFieldName());

                    } else {

                        values = new ArrayList<FileItem>();

                    }

 

                    values.add(item);

                    files.put(item.getFieldName(), values);

                }

            }

        } catch (FileUploadException e) {

            LOG.warn("Unable to parse request", e);

            errors.add(e.getMessage());

        }

}

 

上面的类建立完成后,还需要做一项工作:在struts.xml中添加如下内容:

<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="requestParser"

    class="com.zeige.ResourceMultiPartRequest" scope="default" optional="true" />

<constant name="struts.multipart.handler" value="requestParser" />

 

下面就可以正常使用了,建立两个action,一个用来接收上传文件,以及对接收的文件作相应处理,处理完成后,在return SUCCESS之前去除session中currentUploadStatus属性,一个用来为页面读取实时上传进度服务,这个类中只要将session中的currentUploadStatus对象拿出来按照相应格式返回给客户端即可。
--------------------编程问答-------------------- 楼主留个邮箱。。。。找到一个demo,发你邮箱
--------------------编程问答--------------------
引用 18 楼 pixiaozheng 的回复:
楼主留个邮箱。。。。找到一个demo,发你邮箱
晕倒 我这上不了其他网的。。。你上传到资源好吗?我去下载去 你给我发了连接就好。。。 --------------------编程问答--------------------
引用 17 楼 crazylaa 的回复:
引用 16 楼 ladybirds2008 的回复:

引用 15 楼 pixiaozheng 的回复:
那个确实比较麻烦。。还得去下载一个springside。。
这个比较简单一点。。你看看。。
http://blog.sina.com.cn/s/blog_674b23220100he8x.html
很晕,,我这上不了其他的网。。。看不了。。。
全文在此,我也留一份:
……
十分感谢。。嘿。。 --------------------编程问答-------------------- http://pixiaozheng.download.csdn.net/ 去试试。。第一次上传东西。。也不知道对不对。。 --------------------编程问答--------------------
引用 21 楼 pixiaozheng 的回复:
http://pixiaozheng.download.csdn.net/ 去试试。。第一次上传东西。。也不知道对不对。。
十分感谢。。。。虽然是ssh但是还是有很大的启发作用地。。。 --------------------编程问答-------------------- 等我整理写好后,我给大家共享出来。。。这种demo网上很少。。。我要给大家一个全的。。上传和下载都有的。。以后少的资源我整理好后都免费共享起来。。。不搞吝啬鬼。。。
今天是写不了啦,还有其他设计没有弄好呢。。。很烦。。这两天忙死啦。。。周末休息时间把上传写好。。。
等我好消息吧。。。。 --------------------编程问答-------------------- 哈哈,期待中~~~~~搞好了通知。。第一时间去下载。。。另外友情提示要劳逸结合。。 --------------------编程问答--------------------
引用 24 楼 pixiaozheng 的回复:
哈哈,期待中~~~~~搞好了通知。。第一时间去下载。。。另外友情提示要劳逸结合。。
恩 我会地。。。谢谢。。。 --------------------编程问答-------------------- 以前写过一个struts1的,超复杂,就不拿出来献丑了。后来又这方面要求的,客户端都改用flash上传。flash有直接的API,看发送了多少字节。

不过flash有个不符合multipart boundary标准的bug,可能需要应对一下。 --------------------编程问答--------------------
引用 26 楼 shine333 的回复:
以前写过一个struts1的,超复杂,就不拿出来献丑了。后来又这方面要求的,客户端都改用flash上传。flash有直接的API,看发送了多少字节。
不过flash有个不符合multipart boundary标准的bug,可能需要应对一下。
我也看了好多此类的东西,有点乱。。自己不想写。。主要我是集合上传下载功能跳转,对每一个上传文件都要实时监控,并有大小限制,且有上传下载即时终止功能(此功能必须是能自由存取可有可无,因为在项目的不同模块中应用有所不同)。。。我做的是一个demo只能在struts2上设计,这样在其他功能模块中就可以通用。。不然其他模块有一些乱七八糟的其他技术就不好集合维护,而且条理很乱。。。现在我做一个通用action就ok啦,把下载和上传设计上分离,跳不跳转用boolean参数来控制就ok啦。。。 --------------------编程问答-------------------- 让swfupload来满足你吧!
网站:http://www.swfupload.org/ --------------------编程问答-------------------- 楼主,2个月过去啦,你的demo写好没有,我正需要,麻烦共享一下。谢谢 --------------------编程问答-------------------- 只有servlet+javascript+flex ,没有整合struts2的 --------------------编程问答-------------------- 不太懂 --------------------编程问答-------------------- 留个标记 --------------------编程问答-------------------- --------------------编程问答-------------------- 不太懂,投一票 --------------------编程问答-------------------- 可不可以考虑使用execAndWait拦截器来实现? --------------------编程问答-------------------- 17楼真厉害。 --------------------编程问答-------------------- lz离奇失踪了。。 --------------------编程问答-------------------- http://download.csdn.net/source/2571967 这个里面有完整版的 DWZ JQUERY STRUTS2实现的 --------------------编程问答-------------------- 人呢?贴出来啊 --------------------编程问答-------------------- 同求- - --------------------编程问答-------------------- 干嘛不用jquery? --------------------编程问答--------------------
引用 36 楼 licip 的回复:
17楼真厉害。
 dfgfg --------------------编程问答-------------------- 标记一下。。。 --------------------编程问答-------------------- --------------------编程问答--------------------
哎呀!·这楼主提的问题 ,太Hi了!· 我也学习学习!~ --------------------编程问答-------------------- 好久没有看这里啦,忘记这还有个帖子呢。。
谁需要 留个 邮箱吧。。。统一发放。。网络demo。。。。
受demo启发,自己开发的已经实际应用啦,集成到项目中了。。。 --------------------编程问答-------------------- taochong.123456789@163.com谢谢楼主! --------------------编程问答-------------------- 519134865@qq.com谢谢楼主! --------------------编程问答-------------------- html5可以满足你,我给你源码:
script.js


// common variables
var iBytesUploaded = 0;
var iBytesTotal = 0;
var iPreviousBytesLoaded = 0;
var iMaxFilesize = 1048576; // 1MB
var oTimer = 0;
var sResultFileSize = '';

function secondsToTime(secs) { // we will use this function to convert seconds in normal time format
    var hr = Math.floor(secs / 3600);
    var min = Math.floor((secs - (hr * 3600))/60);
    var sec = Math.floor(secs - (hr * 3600) -  (min * 60));

    if (hr < 10) {hr = "0" + hr; }
    if (min < 10) {min = "0" + min;}
    if (sec < 10) {sec = "0" + sec;}
    if (hr) {hr = "00";}
    return hr + ':' + min + ':' + sec;
};

function bytesToSize(bytes) {
    var sizes = ['Bytes', 'KB', 'MB'];
    if (bytes == 0) return 'n/a';
    var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
    return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
};

function fileSelected() {

    // hide different warnings
    document.getElementById('upload_response').style.display = 'none';
    document.getElementById('error').style.display = 'none';
    document.getElementById('error2').style.display = 'none';
    document.getElementById('abort').style.display = 'none';
    document.getElementById('warnsize').style.display = 'none';

    // get selected file element
    var oFile = document.getElementById('image_file').files[0];

    // filter for image files
    var rFilter = /^(image\/bmp|image\/gif|image\/jpeg|image\/png|image\/tiff)$/i;
    if (! rFilter.test(oFile.type)) {
        document.getElementById('error').style.display = 'block';
        return;
    }

    // little test for filesize
    if (oFile.size > iMaxFilesize) {
        document.getElementById('warnsize').style.display = 'block';
        return;
    }

    // get preview element
    var oImage = document.getElementById('preview');

    // prepare HTML5 FileReader
    var oReader = new FileReader();
        oReader.onload = function(e){

        // e.target.result contains the DataURL which we will use as a source of the image
        oImage.src = e.target.result;

        oImage.onload = function () { // binding onload event

            // we are going to display some custom image information here
            sResultFileSize = bytesToSize(oFile.size);
            document.getElementById('fileinfo').style.display = 'block';
            document.getElementById('filename').innerHTML = 'Name: ' + oFile.name;
            document.getElementById('filesize').innerHTML = 'Size: ' + sResultFileSize;
            document.getElementById('filetype').innerHTML = 'Type: ' + oFile.type;
            document.getElementById('filedim').innerHTML = 'Dimension: ' + oImage.naturalWidth + ' x ' + oImage.naturalHeight;
        };
    };

    // read selected file as DataURL
    oReader.readAsDataURL(oFile);
}
var oXHR;
function startUploading() {
    // cleanup all temp states
    iPreviousBytesLoaded = 0;
    document.getElementById('upload_response').style.display = 'none';
    document.getElementById('error').style.display = 'none';
    document.getElementById('error2').style.display = 'none';
    document.getElementById('abort').style.display = 'none';
    document.getElementById('warnsize').style.display = 'none';
    document.getElementById('progress_percent').innerHTML = '';
    var oProgress = document.getElementById('progress');
    oProgress.style.display = 'block';
    oProgress.style.width = '0px';

    // get form data for POSTing
    //var vFD = document.getElementById('upload_form').getFormData(); // for FF3
    var vFD = new FormData(document.getElementById('upload_form')); 
alert(vFD);
    // create XMLHttpRequest object, adding few event listeners, and POSTing our data
     oXHR = new XMLHttpRequest();        
oXHR.upload.addEventListener('progress', uploadProgress, false);
oXHR.addEventListener('load', uploadFinish, false);
oXHR.addEventListener('error', uploadError, false);
oXHR.addEventListener('abort', uploadAbort, false);

var URL ='http://www.script-tutorials.com/demos/199/upload.php';

    //oXHR.open('POST', url);
    //oXHR.send(vFD);
$.ajax({
   type: 'POST',
   url: URL,
   data: 'cao',
   success: function(msg){
 alert( "Data Saved: " + msg );
   }
});

    // set inner timer
    oTimer = setInterval(doInnerUpdates, 300);
}

 

function doInnerUpdates() { // we will use this function to display upload speed
    var iCB = iBytesUploaded;
    var iDiff = iCB - iPreviousBytesLoaded;

    // if nothing new loaded - exit
    if (iDiff == 0)
        return;

    iPreviousBytesLoaded = iCB;
    iDiff = iDiff * 2;
    var iBytesRem = iBytesTotal - iPreviousBytesLoaded;
    var secondsRemaining = iBytesRem / iDiff;

    // update speed info
    var iSpeed = iDiff.toString() + 'B/s';
    if (iDiff > 1024 * 1024) {
        iSpeed = (Math.round(iDiff * 100/(1024*1024))/100).toString() + 'MB/s';
    } else if (iDiff > 1024) {
        iSpeed =  (Math.round(iDiff * 100/1024)/100).toString() + 'KB/s';
    }

    document.getElementById('speed').innerHTML = iSpeed;
    document.getElementById('remaining').innerHTML = '| ' + secondsToTime(secondsRemaining);        
}

function uploadProgress(e) { // upload process in progress
    if (e.lengthComputable) {
        iBytesUploaded = e.loaded;
        iBytesTotal = e.total;
        var iPercentComplete = Math.round(e.loaded * 100 / e.total);
        var iBytesTransfered = bytesToSize(iBytesUploaded);

        document.getElementById('progress_percent').innerHTML = iPercentComplete.toString() + '%';
        document.getElementById('progress').style.width = (iPercentComplete * 4).toString() + 'px';
        document.getElementById('b_transfered').innerHTML = iBytesTransfered;
        if (iPercentComplete == 100) {
            var oUploadResponse = document.getElementById('upload_response');
            oUploadResponse.innerHTML = '<h1>Please wait...processing</h1>';
            oUploadResponse.style.display = 'block';
        }
    } else {
        document.getElementById('progress').innerHTML = 'unable to compute';
    }
}

function uploadFinish(e) { // upload successfully finished
    var oUploadResponse = document.getElementById('upload_response');
    oUploadResponse.innerHTML = e.target.responseText;
    oUploadResponse.style.display = 'block';

    document.getElementById('progress_percent').innerHTML = '100%';
    document.getElementById('progress').style.width = '400px';
    document.getElementById('filesize').innerHTML = sResultFileSize;
    document.getElementById('remaining').innerHTML = '| 00:00:00';

    clearInterval(oTimer);
}

function uploadError(e) { // upload error
    document.getElementById('error2').style.display = 'block';
    clearInterval(oTimer);
}  

function uploadAbort(e) { // upload abort
    document.getElementById('abort').style.display = 'block';
    clearInterval(oTimer);
}

--------------------编程问答-------------------- html

<html>
    <head>
        <meta charset="gb2312" />
        <title>Pure HTML5 file upload | Script Tutorials</title>
        <link href="css/main.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.4.2.js"></script>
        <script src="js/script.js"></script>
    </head>
    <body>
        <header>
            <h2>Pure HTML5 file upload</h2>
            <a href="http://www.script-tutorials.com/pure-html5-file-upload/" class="stuts">Back to original tutorial on <span>Script Tutorials</span></a>
        </header>
        <div class="container">
            <div class="contr"><h2>You can select the file (image) and click Upload button</h2></div>

            <div class="upload_form_cont">
                <form id="upload_form" enctype="multipart/form-data">
                    <div>
                        <div><label for="image_file">Please select image file</label></div>
                        <div><input type="file" name="image_file" id="image_file" onchange="fileSelected();" /></div>
                    </div>
                    <div>
                        <input type="button" value="Upload" onclick="startUploading()" />
                    </div>
                    <div id="fileinfo">
                        <div id="filename"></div>
                        <div id="filesize"></div>
                        <div id="filetype"></div>
                        <div id="filedim"></div>
                    </div>
                    <div id="error">You should select valid image files only!</div>
                    <div id="error2">An error occurred while uploading the file</div>
                    <div id="abort">The upload has been canceled by the user or the browser dropped the connection</div>
                    <div id="warnsize">Your file is very big. We can't accept it. Please select more small file</div>

                    <div id="progress_info">
                        <div id="progress"></div>
                        <div id="progress_percent"> </div>
                        <div class="clear_both"></div>
                        <div>
                            <div id="speed"> </div>
                            <div id="remaining"> </div>
                            <div id="b_transfered"> </div>
                            <div class="clear_both"></div>
                        </div>
                        <div id="upload_response"></div>
                    </div>
                </form>

                <img id="preview" />
            </div>
        </div>
    </body>
</html>
--------------------编程问答-------------------- css:

*{
    margin:0;
    padding:0;
}
body {
    background-color:#74b1d1;
    color:#fff;
    font:14px/1.3 Arial,sans-serif;
}
header {
    background-color:#212121;
    box-shadow: 0 -1px 2px #111111;
    display:block;
    height:70px;
    position:relative;
    width:100%;
    z-index:100;
}
header h2{
    font-size:22px;
    font-weight:normal;
    left:50%;
    margin-left:-400px;
    padding:22px 0;
    position:absolute;
    width:540px;
}
header a.stuts,a.stuts:visited{
    border:none;
    text-decoration:none;
    color:#fcfcfc;
    font-size:14px;
    left:50%;
    line-height:31px;
    margin:23px 0 0 110px;
    position:absolute;
    top:0;
}
header .stuts span {
    font-size:22px;
    font-weight:bold;
    margin-left:5px;
}
.container {
    overflow:hidden;
    width:960px;
    margin:20px auto;
}
.contr {
    background-color:#212121;
    padding:10px 0;
    text-align:center;

    border-radius:10px 10px 0 0;
    -moz-border-radius:10px 10px 0 0;
    -webkit-border-radius:10px 10px 0 0;
}

.upload_form_cont {
    background: -moz-linear-gradient(#ffffff, #f2f2f2);
    background: -ms-linear-gradient(#ffffff, #f2f2f2);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f2f2f2));
    background: -webkit-linear-gradient(#ffffff, #f2f2f2);
    background: -o-linear-gradient(#ffffff, #f2f2f2);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f2f2f2');
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f2f2f2')";
    background: linear-gradient(#ffffff, #f2f2f2);

    color:#000;
    overflow:hidden;
}
#upload_form {
    float:left;
    padding:20px;
    width:700px;
}
#preview {
    background-color:#fff;
    display:block;
    float:right;
    width:200px;
}
#upload_form > div {
    margin-bottom:10px;
}
#speed,#remaining {
    float:left;
    width:100px;
}
#b_transfered {
    float:right;
    text-align:right;
}
.clear_both {
    clear:both;
}
input {
    border-radius:10px;
    -moz-border-radius:10px;
    -ms-border-radius:10px;
    -o-border-radius:10px;
    -webkit-border-radius:10px;

    border:1px solid #ccc;
    font-size:14pt;
    padding:5px 10px;
}
input[type=button] {
    background: -moz-linear-gradient(#ffffff, #dfdfdf);
    background: -ms-linear-gradient(#ffffff, #dfdfdf);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #dfdfdf));
    background: -webkit-linear-gradient(#ffffff, #dfdfdf);
    background: -o-linear-gradient(#ffffff, #dfdfdf);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dfdfdf');
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dfdfdf')";
    background: linear-gradient(#ffffff, #dfdfdf);
}
#image_file {
    width:400px;
}
#progress_info {
    font-size:10pt;
}
#fileinfo,#error,#error2,#abort,#warnsize {
    color:#aaa;
    display:none;
    font-size:10pt;
    font-style:italic;
    margin-top:10px;
}
#progress {
    border:1px solid #ccc;
    display:none;
    float:left;
    height:14px;

    border-radius:10px;
    -moz-border-radius:10px;
    -ms-border-radius:10px;
    -o-border-radius:10px;
    -webkit-border-radius:10px;

    background: -moz-linear-gradient(#66cc00, #4b9500);
    background: -ms-linear-gradient(#66cc00, #4b9500);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #66cc00), color-stop(100%, #4b9500));
    background: -webkit-linear-gradient(#66cc00, #4b9500);
    background: -o-linear-gradient(#66cc00, #4b9500);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#66cc00', endColorstr='#4b9500');
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#66cc00', endColorstr='#4b9500')";
    background: linear-gradient(#66cc00, #4b9500);
}
#progress_percent {
    float:right;
}
#upload_response {
    margin-top: 10px;
    padding: 20px;
    overflow: hidden;
    display: none;
    border: 1px solid #ccc;

    border-radius:10px;
    -moz-border-radius:10px;
    -ms-border-radius:10px;
    -o-border-radius:10px;
    -webkit-border-radius:10px;

    box-shadow: 0 0 5px #ccc;
    background: -moz-linear-gradient(#bbb, #eee);
    background: -ms-linear-gradient(#bbb, #eee);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #bbb), color-stop(100%, #eee));
    background: -webkit-linear-gradient(#bbb, #eee);
    background: -o-linear-gradient(#bbb, #eee);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bbb', endColorstr='#eee');
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#bbb', endColorstr='#eee')";
    background: linear-gradient(#bbb, #eee);
}
--------------------编程问答-------------------- 给我也发一份吧,谢谢 307977367@qq.com --------------------编程问答-------------------- dokia@qq.com 楼主 谢谢咯... --------------------编程问答--------------------
引用 49 楼  的回复:
html5可以满足你,我给你源码:
script.js

JScript code



// common variables
var iBytesUploaded = 0;
var iBytesTotal = 0;
var iPreviousBytesLoaded = 0;
var iMaxFilesize = 1048576; // 1MB
var oTimer = ……
html5 这个 还不会呢 学习哦。。 --------------------编程问答--------------------  youjiao015@163.com  楼主,谢谢呀!也发我一份吧,项目中正要这个,找了好久了 --------------------编程问答--------------------
引用 54 楼  的回复:
引用 49 楼  的回复:
html5可以满足你,我给你源码:
script.js

JScript code



// common variables
var iBytesUploaded = 0;
var iBytesTotal = 0;
var iPreviousBytesLoaded = 0;
var iMaxFilesize = 1048576; // 1M……


还在研究这个啊?  2年了哦 --------------------编程问答-------------------- LZ,麻烦发我一份,1246965389@qq.com,多谢啦! --------------------编程问答-------------------- 196001330@qq.com 谢谢LZ --------------------编程问答-------------------- 625460860@qq.com 遇到同一难题 麻烦 发一份 谢谢! --------------------编程问答-------------------- 这个可爱的帖子 不能关啊。。。 --------------------编程问答-------------------- --------------------编程问答-------------------- arvin_quan@thoughtchina.com.cn  謝謝LZ --------------------编程问答-------------------- 很有用的   学习下 --------------------编程问答-------------------- 455743518@qq.com楼主给我也发一份吧,急用 --------------------编程问答-------------------- 350081160@qq.com  学习下 --------------------编程问答-------------------- 502422889@qq.com
楼主也发我一份吧,谢谢,之前也折腾了好长时间,还是没弄出来,谢谢楼主~ --------------------编程问答-------------------- 楼主也给我发一份吧,我的邮箱:928012574@qq.com。 --------------------编程问答-------------------- 楼主可否也发我一份,1123979477@qq.com 3q --------------------编程问答-------------------- 楼主可否也发我一份,353306158@qq.com 3q --------------------编程问答-------------------- 同求~
93442350@qq.com
--------------------编程问答-------------------- 同求
461379649@qq.com
对实现监控的进度条没搞明白,只会上传的功能 --------------------编程问答-------------------- 同求 楼主 867628247@qq.com --------------------编程问答-------------------- 给我也发一份   18320984330@163.com  谢了 --------------------编程问答-------------------- lvleix7@163.com
急求 谢谢楼主 --------------------编程问答-------------------- 419420865@qq.com   

楼主也发我一份吧,谢谢啦 --------------------编程问答-------------------- 楼主也给我发一份呀 heng17173@163.com
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,