博客
关于我
bootstrap+springMvc 文件上传
阅读量:120 次
发布时间:2019-02-26

本文共 1731 字,大约阅读时间需要 5 分钟。

??????????

1. ?????????

?????????????????????????????

  • ?????JS?

    ????????????JS?????????????????????????????????????

  • XML??????

    ????????????????????????????????????????????????????????

  • JSP????

    ?JSP???????????????????????

    • ?????????Excel????????????????
    • ????????????????????????
    • ????????Bootstrap??????UI??????????????????
    • ??????????????????????????????
  • JS???????

    ?JS????????????????????

    • ????????
    • ????????
    • ????????
    • ??????????
    • ??????????
  • 2. ??????

    ???????????????????????????

  • ??????

    ??MultipartHttpServletRequest?????????????request.getParameter???

    if (request instanceof MultipartHttpServletRequest) {    multipartRequest = (MultipartHttpServletRequest) request;    MultipartFile file = multipartRequest.getFile("file");
  • ???????????

    ????????????????????????????????

    String uploadFilePath = request.getSession().getServletContext().getRealPath("/uploadFile/");File myPath = new File(uploadFilePath);if (!myPath.exists()) {    myPath.mkdir();}
  • ?????????

    ???????????????????????

    String fileName = file.getOriginalFilename();String filePath = uploadFilePath + File.separator + fileName;File outputFile = new File(filePath);FileOutputStream fs = new FileOutputStream(outputFile);byte[] buffer = new byte[len];int byteread = 0;while ((byteread = inputStream.read(buffer)) != -1) {    fs.write(buffer, 0, byteread);    fs.flush();}fs.close();
  • ??????

    ?????????????????????????????????

    Map
    result = new HashMap<>();result.put("success", "true");result.put("msg", "???????");return new ModelAndView("jsonView", result);
  • 3. ???????

    ????????????????????????????????????????

  • ??????

    • ?????????????
    • ????????????
    • ????????????
  • ????????

    • ????????????
    • ??????????
    • ???????????
  • ????

    • ?????????????????????
    • ??????????
  • ??????????????????????????????

    转载地址:http://tssu.baihongyu.com/

    你可能感兴趣的文章
    python:从列表中创建元组列表
    查看>>
    Python:从嵌套列表中删除重复项
    查看>>
    Python:从间隔映射到值
    查看>>
    Python:使用 shell=False 的子进程调用不起作用
    查看>>
    Python:修改 PATH 环境变量的平台无关方式
    查看>>
    Python:假与 0
    查看>>
    Python:函数使用
    查看>>
    Python:函数进阶
    查看>>
    Python:在整数的二进制表示中查找最长的二进制间隙
    查看>>
    Python:如何从二进制转换为 base 64 并返回?
    查看>>
    Python:如何以非阻塞方式读取子进程的标准输出
    查看>>
    Python:如何使用 plotly 制作阴影区域或交替背景颜色?
    查看>>
    Python:如何根据日期时间获取值的计数
    查看>>
    python:如何检测串行 COM 上的设备名称/ID
    查看>>
    Python:如何模拟 datetime.utcnow()?
    查看>>
    Python:如果DataFrames之间的其他值匹配,则对DataFrame中的值求和
    查看>>
    Python:字典思维
    查看>>
    Python:将 HEX 字符串转换为字节
    查看>>
    Python:将列表与范围列表合并
    查看>>
    Python:将列表列表初始化为一定大小,
    查看>>