element ui 文件上传模板





package com.gpdi.springbootshirojwt.controller;

import com.gpdi.springbootshirojwt.config.R;
import com.gpdi.springbootshirojwt.utils.ExcelUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @Description:
 * @Author: Lxq
 * @Date: 2019/12/22 9:29
 */
@RestController
@RequestMapping("/api")
public class TestController {

    @PostMapping("/uploadExcel")
    public R userLogout(@RequestParam(value = "file")MultipartFile file) throws IOException {
        System.out.println(file.getName());
        System.out.println(file.getOriginalFilename());
        System.out.println(file.getContentType());
        System.out.println(file.getSize());
        InputStream inputStream = file.getInputStream();
        List objects = ExcelUtils.readLessThan1000RowBySheetAndStream(inputStream, null);
        System.out.println(objects);
        return R.ok("success");
    }
}

 

你可能感兴趣的:(vue,vue上传文件模板)