bootstrap fileinput插件 上传又拍云DEMO 显示进度条

由于公司需要实现文件上传的功能,需要展示大文件上传的进度,因此记录
开发环境:IntelliJ IDEA 2018.1.5 x64;Spring Boot;bootstrap 3;bootstrap-fileinput;又拍云 sdk
首先搭建起springboot环境:
bootstrap fileinput插件 上传又拍云DEMO 显示进度条_第1张图片
配置POM(引入了thymeleaf模板引擎):



    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.1.2.RELEASE
         
    
    com.upyun
    demo
    0.0.1-SNAPSHOT
    demo
    Demo project for upyun

    
        1.8
    

    
        
            org.springframework.boot
            spring-boot-starter
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            org.springframework.boot
            spring-boot-starter-thymeleaf
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    



application.yml-配置模板引擎:


spring:
  #配置thymeleaf
  thymeleaf:
    prefix: classpath:/templates/
    check-template-location: true
    cache: false
    suffix: .html
    encoding: UTF-8
    mode: HTML5
    servlet:
      content-type: text/html

首先建立前端页面

bootstrap fileinput插件 上传又拍云DEMO 显示进度条_第2张图片

至此发现一个问题
在这里插入图片描述

bootstrap fileinput插件 上传又拍云DEMO 显示进度条_第3张图片
在Chrome中使用REST API 发送请求时,在请求的HTTP Header中添加Date参数,Chrome会提示:Refused to set unsafe header “Date” ,因为Chrome严格按照W3C的要求执行,Date为不安全字符(详情查看http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method)

由此发现无法在前端请求头中写入date字段,想要在前端绕过服务器上传到又拍云失败

你可能感兴趣的:(技术,又拍云,前端,辣鸡)