springmvc带进度条的多文件上传

木极子 木极子     2022-12-09     738

关键词:

1、关于文件上传进度条的实现

  1. 在说Spring MVC文件上传尤其是带滚动条之前先用servlet做一个简单的文件上传并返回进度信息这样的功能。

    (1)需要两个包:
    commons-fileupload-1.3.1.jar
    commons-io-1.4.jar
    上面这两个包是Apache 推出的两个包,可以从网上找

    (2)创建一个记录上传状态的java文件(UploadStatus.java):

package com.zxm.fileupload;

public class UploadStatus 
    private long bytesRead;//已读数据
    private long contentLength;//文件总数据
    private long items;//第几个文件
    private long startTime = System.currentTimeMillis();//开始时间
    private long useTime = System.currentTimeMillis();//已用时间
    private int percent;//完成百分比

    public long getBytesRead() 
        return bytesRead;
    
    public void setBytesRead(long bytesRead) 
        this.bytesRead = bytesRead;
    
    public long getContentLength() 
        return contentLength;
    
    public void setContentLength(long contentLength) 
        this.contentLength = contentLength;
    
    public long getItems() 
        return items;
    
    public void setItems(long items) 
        this.items = items;
    
    public long getStartTime() 
        return startTime;
    
    public void setStartTime(long startTime) 
        this.startTime = startTime;
    
    public long getUseTime() 
        return useTime;
    
    public void setUseTime(long useTime) 
        this.useTime = useTime;
    
    public int getPercent() 
        return percent;
    
    public void setPercent(int percent) 
        this.percent = percent;
    
    @Override
    public String toString() 
        // TODO Auto-generated method stub
        return "UploadStatus [percent=" + percent + ", items=" + items + "]";
    

(3)创建一个监听上传信息的监听器,需要实现ProgressListener这个接口(UploadListener.java):

package com.zxm.fileupload;

import javax.servlet.http.HttpSession;

import org.apache.commons.fileupload.ProgressListener;

public class UploadListener implements ProgressListener
    private HttpSession session;
    public UploadListener(HttpSession session)
        super();
        this.session = session;
        UploadStatus uploadStatus = new UploadStatus();
        session.setAttribute("upload_status", uploadStatus);
    

    @Override
    public void update(long bytesRead, long contentLength, int items) 
        // TODO Auto-generated method stub
        UploadStatus uploadStatus = (UploadStatus) session.getAttribute("upload_status");
        uploadStatus.setBytesRead(bytesRead);
        uploadStatus.setContentLength(contentLength);
        uploadStatus.setItems(items);
        uploadStatus.setUseTime(System.currentTimeMillis()-uploadStatus.getStartTime());
        uploadStatus.setPercent((int)(100*bytesRead/contentLength));
        session.setAttribute("upload_status", uploadStatus);

    


(4)创建servlet文件(ProgressUploadServlet.java):

package com.zxm.bean.servlet;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import com.zxm.fileupload.UploadListener;
import com.zxm.fileupload.UploadStatus;

public class ProgressUploadServlet extends HttpServlet 

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private ServletContext sc;
    private String savePath;
    public void init(ServletConfig config) throws ServletException 
        savePath = config.getInitParameter("savePath");
        sc = config.getServletContext();
    

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException 

         response.setHeader("Cache-Control", "no-store");  
            response.setHeader("Pragrma", "no-cache");  
            response.setDateHeader("Expires", 0);  
            response.setContentType("text/html;charset=utf-8");  
            UploadStatus status = (UploadStatus) request.getSession(true)  
                    .getAttribute("upload_status");  

            if (status == null)   
                response.getWriter().println("没有上传信息");  

                return;  
              
            int percent=status.getPercent();
            long length=status.getBytesRead()/1024/1204;
            long totalLength=status.getContentLength()/1204/1024;
            long time=status.getUseTime();
            long velocity=status.getBytesRead()/time;
            long totalTime=status.getContentLength()/velocity;
            long timeLeft=totalTime-time;

            // 格式:百分比||已完成数(M)||文件总长度(M)||传输速率(K)||已用时间(s)||估计总时间(s)||估计剩余时间(s)||正在上传第几个文件  
            String value = percent + "||" + length + "||" + totalLength + "||"  
                    + velocity + "||" + time + "||" + totalTime + "||" + timeLeft  
                    + "||" + status.getItems();  

            response.getWriter().println(value);  
    


    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException 
        HttpSession session = request.getSession(true);
        UploadListener listener=new UploadListener(session);
        DiskFileItemFactory factory=new DiskFileItemFactory();
        ServletFileUpload upload=new ServletFileUpload(factory);
        upload.setProgressListener(listener);
        try
            List itemList=upload.parseRequest(request);
            Iterator itr=itemList.iterator();
            while(itr.hasNext())
                FileItem item=(FileItem)itr.next();
                if(item.isFormField())
                    System.out.println("表单属性"+item.getFieldName()+"="+item.getString("UTF-8"));
                else
                    if(item.getName()!=null&&!item.getName().equals(""))
                        File tempFile = new File(item.getName());
                        File file=new File(sc.getRealPath("/")+"\\\\"+savePath,tempFile.getName());
                        item.write(file);
                        response.getWriter().println("文件已上传"+file.getName());
                    
                
            
        catch(Exception e)
            response.getWriter().println("上传文件失败:"+e.getMessage());
        
    

这个servlet,当get方式请求时获取到的是上传信息的状态,当执行POST方式的请求的时候是进行文件上传。
从这个servlet的doPost方法中可以知道,主要是在创建一个ServletFileUpload对象,并且友这个ServletFileUpload对象绑定一个监听,也就是我们实现接口的监听。

2、Spring MVC带进度条的多文件上传

Spring MVC的搭建我这里不说了,如果不知道的可以参考这个《Spring MVC浅尝》
(1)需要的包:

(2)web.xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>SpringMVCFileUpload</display-name>

  <servlet>
    <servlet-name>dispatch</servlet-name>
    <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:spring-mvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>dispatch</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <listener>
    <listener-class>
        org.springframework.web.util.IntrospectorCleanupListener
    </listener-class>
  </listener>

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

(3)spring-mvc.xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.1.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
    <context:component-scan base-package="com.zxm"></context:component-scan>
    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
        <property name="messageConverters">
            <list>
                <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                    <property name="supportedMediaTypes">
                        <list>
                            <value>text/html;charset=UTF-8</value>
                            <value>application/json;charset=UTF-8</value>
                        </list>
                    </property>
                </bean>
            </list>
        </property>
    </bean>

    <!-- 定义跳转的文件的前后缀 ,视图模式配置-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!-- 这里的配置我的理解是自动给后面action的方法return的字符串加上前缀和后缀,变成一个 可用的url地址 -->
        <property name="prefix" value="/" />
        <property name="suffix" value=".jsp" />
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
    </bean>

    <!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 -->
    <bean id="multipartResolver" class="com.zxm.fileupload.UploadCommonsMultipartResolver">
        <!-- 默认编码 -->
        <property name="defaultEncoding" value="utf-8" />
        <!-- 文件大小最大值 -->
        <property name="maxUploadSize" value="10485760000" />
        <!-- 内存中的最大值 -->
        <property name="maxInMemorySize" value="40960" />
    </bean>

</beans>

注意上面的这个代码:

 <bean id="multipartResolver" class="com.zxm.fileupload.UploadCommonsMultipartResolver">
        <!-- 默认编码 -->
        <property name="defaultEncoding" value="utf-8" />
        <!-- 文件大小最大值 -->
        <property name="maxUploadSize" value="10485760000" />
        <!-- 内存中的最大值 -->
        <property name="maxInMemorySize" value="40960" />
    </bean>

com.zxm.fileupload.UploadCommonsMultipartResolver这个是自己复写的,下面我会贴出代码。
(5)UploadCommonsMultipartResolver的实现:

package com.zxm.fileupload;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.FileUploadBase;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.web.multipart.MultipartException;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

public class UploadCommonsMultipartResolver extends CommonsMultipartResolver
    @Override
    protected MultipartParsingResult parseRequest(HttpServletRequest request)
            throws MultipartException 
        HttpSession session = request.getSession();
        String encoding = "utf-8";
        FileUpload fileUpload = prepareFileUpload(encoding);
        UploadListener uploadListener = new UploadListener(session);
        fileUpload.setProgressListener(uploadListener);

        try 
            List<FileItem> fileItem = ((ServletFileUpload)fileUpload).parseRequest(request);
            return parseFileItems(fileItem, encoding);
         catch (FileUploadBase.SizeLimitExceededException ex) 
            // TODO Auto-generated catch block
            throw new MaxUploadSizeExceededException(fileUpload.getSizeMax(), ex);
        catch (FileUploadException ex) 
            // TODO: handle exception
            throw new MultipartException("Could not parse multipart servlet request",ex);
        
    


看完上面这个代码应该可以知道了,复写parseRequest方法的原因是,在这个方法里面实现对文件上传的监听:

FileUpload fileUpload = prepareFileUpload(encoding);
UploadListener uploadListener = new UploadListener(session);
fileUpload.setProgressListener(uploadListener);

(6)好了,最后一步骤,文件上传Controller的实现(TestController.java):

package com.zxm.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

import com.zxm.bean.User;
import com.zxm.fileupload.UploadCommonsMultipartResolver;
import com.zxm.fileupload.UploadStatus;
@Controller
@RequestMapping("/SpringMVC006")
public class TestController 
    /*
     * 通过流的方式上传文件
     * @RequestParam("file") 将name=file控件得到的文件封装成CommonsMultipartFile 对象
     */
    @RequestMapping("fileUpload")
    public String  fileUpload(@RequestParam("file") CommonsMultipartFile file) throws IOException 

        //用来检测程序运行时间
        long  startTime=System.currentTimeMillis();
        System.out.println("fileName:"+file.getOriginalFilename());

        try 
            //获取输出流
            OutputStream os=new FileOutputStream("E:/"+new Date().getTime()+file.getOriginalFilename());
            //获取输入流 CommonsMultipartFile 中可以直接得到文件的流
            InputStream is=file.getInputStream();
            byte[] bts = new byte[1024];
            //一个一个字节的读取并写入
            while(is.read(bts)!=-1)
            
                os.write(bts);
            
           os.flush();
           os.close();
           is.close();

         catch (FileNotFoundException e) 
            // TODO Auto-generated catch block
            e.printStackTrace();
        
        long  endTime=System.currentTimeMillis();
        System.out.println("方法一的运行时间:"+String.valueOf(endTime-startTime)+"ms");
        return "/success"; 
    

    /*
     * 采用file.Transto 来保存上传的文件
     */
    @RequestMapping("fileUpload2")
    public String  fileUpload2(@RequestParam("file") CommonsMultipartFile file) throws IOException 
         long  startTime=System.currentTimeMillis();
        System.out.println("fileName:"+file.getOriginalFilename());
        String path="E:/"+new Date().getTime()+file.getOriginalFilename();

        File newFile=new File(path);
        //通过CommonsMultipartFile的方法直接写文件(注意这个时候)
        file.transferTo(newFile);
        long  endTime=System.currentTimeMillis();
        System.out.println("方法二的运行时间:"+String.valueOf(endTime-startTime)+"ms");
        return "/success"; 
    

    /*
     *采用spring提供的上传文件的方法
     */
    @RequestMapping("springUpload")
    public String  springUpload(HttpServletRequest request) throws IllegalStateException, IOException
    
         long  startTime=System.currentTimeMillis();
         //将当前上下文初始化给  CommonsMutipartResolver (多部分解析器)
        CommonsMultipartResolver multipartResolver=new CommonsMultipartResolver(
                request.getSession().getServletContext());
        //检查form中是否有enctype="multipart/form-data"
        if(multipartResolver.isMultipart(request))
        
            //将request变成多部分request
            MultipartHttpServletRequest multiRequest=(MultipartHttpServletRequest)request;
           //获取multiRequest 中所有的文件名
            Iterator iter=multiRequest.getFileNames();

            while(iter.hasNext())
            

                //一次遍历所有文件
                MultipartFile file=multiRequest.getFile(iter.next().toString());
                if(file!=null)
                
                    String path="E:/springUpload"+file.getOriginalFilename();
                    //上传
                    file.transferTo(new File(path));
                

            

        
        long  endTime=System.currentTimeMillis();
        System.out.println("方法三的运行时间:"+String.valueOf(endTime-startTime)+"ms");
        return "/success"; 
    

    @RequestMapping("/fileUpload3.do")
    public String fileUpload3(@RequestParam(value="file",required= false) MultipartFile[] files,HttpSession session,User user) throws IOException

         long  startTime=System.currentTimeMillis();
         System.out.println(files.length);
         System.out.println(user.getUsername()+"===="+user.getPassword());
         if(files!=null&&files.length>0)  
             //循环获取file数组中得文件  
             for(int i = 0;i<files.length;i++)  
                 MultipartFile file = files[i];  
                 //这个方法最慢
                 /*FileUtils.writeByteArrayToFile(new File("E:\\\\"+file.getOriginalFilename()), file.getBytes());*/

                 //这个方法最快
                 file.transferTo(new File("E:\\\\"+file.getOriginalFilename()));

                 //这个方法其次
                /*OutputStream os=new FileOutputStream("E:/"+file.getOriginalFilename());
                 //获取输入流 CommonsMultipartFile 中可以直接得到文件的流
                 InputStream is=file.getInputStream();
                 byte[] bts = new byte[2048];
                 //一个一个字节的读取并写入
                 while(is.read(bts)!=-1)
                 
                     os.write(bts);
                 
                os.flush();
                os.close();
                is.close();*/
               
          
         long  endTime=System.currentTimeMillis();
         System.out.println("方法四的运行时间:"+String.valueOf(endTime-startTime)+"ms");
        return "success";
    

    /**
     * 这里是获取上传文件状态信息的访问接口
     * @param session
     * @return
     */
    @ResponseBody
    @RequestMapping("getStatus.do")
    public UploadStatus getStatus(HttpSession session)
        return (UploadStatus)session.getAttribute("upload_status");
    




代码中提供了五个办法,在这里简单说明一下:

  • fileUpload:单文件上传,通过流的方式上传文件。
  • fileUpload2:单文件上传,采用file.Transto 来保存上传的文件。
  • springUpload:多文件上传,但是注意这个是在没有使用自己覆写方法后的对象(UploadCommonsMultipartResolver),在使用原生对象(CommonsMultipartResolver)的时候可用。
  • fileUpload3:多文件上传,这个是我们在使用我们自己复写方法后的对象的情况下进行调用的访问接口。
  • getStatus:获取文件上传状态信息。

(7)最后一步, 前台实现:

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>文件上传</title>
<script type="text/javascript" src="scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
    function showStatus()
        var intervalId = setInterval(function()
             $.get("SpringMVC006/getStatus.do",,function(data,status)
                console.log(data);
                var percent = data.percent;
                if(percent >= 100)
                    clearInterval(intervalId);
                    percent = 100;//不能大于100
                
                $("#result").width(percent+"%");
            ,"json");
        ,100);
    

</script>
</head>
<body>
<!--  -->
    <form action="SpringMVC006/fileUpload3.do" method="POST" enctype="multipart/form-data" onsubmit="showStatus()">
        <div id="uploadDiv">
            <input type="file" name="file" multiple id="uploadFile"/>
        </div>

        <input type="submit" value="提交"/>

    </form>

    <div style="border:black solid 1px; width: 800px;height: 10px;">
        <div id="result" style="height: 8px;background: green;position: relative; top: 1px;left: 1px;"></div>
    </div>

</body>
</html>

3、Spring MVC Ajax上传文件

用Ajax上传文件也很简单,前台页面变一下:

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>文件上传</title>
<script type="text/javascript" src="scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
    function showStatus()
        var intervalId = setInterval(function()
             $.get("SpringMVC006/getStatus.do",,function(data,status)
                console.log(data);
                var percent = data.percent;
                if(percent >= 100)
                    clearInterval(intervalId);
                    percent = 100;//不能大于100
                
                $("#result").width(percent+"%");
            ,"json");
        ,100);
    
    function ajaxtSubmit()
        var files = document.getElementById("uploadFile").files;
        alert(files.length);
        var formData = new FormData();
        for(var i=0

java多文件上传显示进度条

...朋友联系我,扣-15080818,跪求!使用  apachefileupload  ,springMVC  jquery1.6x,bootstrap 实现一个带进度条的多文件上传,由于fileupload的局限,暂不能实现每个上传文件都显示进度条,只能实现一个总的进度条,效果如图:1、jsp页面&... 查看详情

jqueryajax实现上传文件代码,带进度条

原文:jqueryajax实现上传文件代码,带进度条 源代码下载地址:http://www.zuidaima.com/share/1550463291116544.htmajax上传文件代码,带进度条的。首页http://localhost:端口/项目名/common/test.htm上传中标签: jquery ajax 上传  查看详情

jqueryajax实现上传文件代码,带进度条

原文:jqueryajax实现上传文件代码,带进度条 源代码下载地址:http://www.zuidaima.com/share/1550463291116544.htmajax上传文件代码,带进度条的。首页http://localhost:端口/项目名/common/test.htm上传中标签: jquery ajax 上传 ... 查看详情

使用 Java 上传文件(带进度条)

】使用Java上传文件(带进度条)【英文标题】:FileUploadwithJava(withprogressbar)【发布时间】:2010-09-2006:17:55【问题描述】:我对Java非常陌生,而且我主要是边学边自学,所以我开始构建一个小程序。我想做一个可以从本地磁盘中... 查看详情

带进度条的文件复制

】带进度条的文件复制【英文标题】:FileCopywithProgressBar【发布时间】:2011-08-2800:40:16【问题描述】:我使用了这个代码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.IO;namespaceWindowsApplication 查看详情

HTML5:带有进度条的 AJAX 文件上传

】HTML5:带有进度条的AJAX文件上传【英文标题】:HTML5:AJAXfileuploadwithprogressbar【发布时间】:2011-11-0602:38:13【问题描述】:我正在寻找一个带有HTML5进度条的文件上传器。我尝试使用其他地方的一些教程,包括SO。ThisSOanswer(被接... 查看详情

带有 Swing 进度条的多线程

】带有Swing进度条的多线程【英文标题】:MultithreadingwithSwingprogressbar【发布时间】:2015-05-2822:52:31【问题描述】:在执行RMI连接期间,我想不出如何让进度条响应,所以我决定向您寻求帮助。代码如下:ThreadperformLogin=newThread(newR... 查看详情

关于文件上传下载以及其他进度条的实现

现在我的上传,下载,或者某个批量的进度的进度条实现思路都是这样:  定义一自定义类,列出总数量,完成数(有需求决定可分成功与失败)  然后访问链接的时候进行处理,将session中存入自定义类,自定义类中存入... 查看详情

应用程序 QT 崩溃(带进度条的 ftp 下载)

】应用程序QT崩溃(带进度条的ftp下载)【英文标题】:CrashingofapplicationQT(ftpdownloadingwithprogressbar)【发布时间】:2014-05-0721:23:47【问题描述】:我想创建一个应用程序,通过这个我可以从我的ftp服务器下载文件并在进度条中显示... 查看详情

Flutter 上传带有进度条的大文件。 App 和 Web 都支持

】Flutter上传带有进度条的大文件。App和Web都支持【英文标题】:Flutteruploadlargefilewithprogressbar.AppandWebbothsupport【发布时间】:2021-06-2304:49:49【问题描述】:我遇到上传大文件的问题。当从应用程序上传文件工作正常但网络挂起时... 查看详情

简单的跨浏览器,带有进度条的 jQuery/PHP 文件上传 [关闭]

】简单的跨浏览器,带有进度条的jQuery/PHP文件上传[关闭]【英文标题】:Simplecross-browser,jQuery/PHPfileuploadwithprogressbar[closed]【发布时间】:2012-05-1516:03:16【问题描述】:我知道有几个关于此的主题,但没有一个为文件上传脚本提供... 查看详情

文件上传进度条干扰控制器重定向

】文件上传进度条干扰控制器重定向【英文标题】:FileuploadprogressbarinterfereswithControllerredirect【发布时间】:2021-11-1610:23:43【问题描述】:我有一个文件提交表单和一个跟踪上传进度的进度条。但是,控制进度条的javascript会干扰... 查看详情

带有进度条的 jQuery ajax 上传 - 没有 flash

】带有进度条的jQueryajax上传-没有flash【英文标题】:jQueryajaxuploadwithprogressbar-noflash【发布时间】:2011-02-1210:59:54【问题描述】:我正在寻找类似于uploadify的文件上传器,其进度条不依赖于Flash,最好使用jQuery-这可能吗?【问题... 查看详情

在vuex中带进度条的FIie上传

】在vuex中带进度条的FIie上传【英文标题】:FIieuploadwithprogressbarinvuex【发布时间】:2020-07-0800:18:19【问题描述】:我无法从VueX操作文件中获取组件中的百分比。它不像反应式我用这篇文章作为指导https://serversideup.net/file-upload-prog... 查看详情

前端上传文件实时显示进度条和上传速度的工作原理是怎样的?

...间是不对的,应为写入时间。项目框架采用spring+hibernate+springMVC如果上传文件不想使用flash那么你可以采用html5;截图前段模块是bootstarp框架;不废话直接来代码;spring-mvc配置文件。nginx话lua可以拿到链接的套接口,读取套接口就可以... 查看详情

struts+ajax上传文件进度条的问题

上传文件ajax读取进度总是只能直接100%,下面结果说明监听器是可以正常取得值得,就是ajax无法异步取得大小而是最后才取得。ajax代码在下面update34370;51925;1update37895;51925;1update41949;51925;1update45474;51925;1update49528;51925;1update51925;51925;... 查看详情

带进度条的重定向

avaScript跳转方法一:<scriptlanguage="javascript">    window.location="http://www.baidu.com";</script>方法二:<scriptlanguage="javascript">    document. 查看详情

简洁大气带进度条的url跳转页面html源码

简介:简洁大气带进度条的URL跳转页面HTML源码可用于网站内链接跳转,或者广告链接跳转网盘下载地址:http://nb8.net/smTgTV0QtPF0图片: 查看详情