博客
关于我
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/

    你可能感兴趣的文章
    Pomelo开发中Web客户端开发API简介
    查看>>
    QT教程2:QT5的体系构架
    查看>>
    PON架构(全光网络)
    查看>>
    PoolingHttpClientConnectionManager原理剖析
    查看>>
    POP-一个点击带有放大还原的动画效果
    查看>>
    POP3 协议在计算机网络中的优缺点
    查看>>
    Portaudio笔记-WASAPI
    查看>>
    position:fixed失效情况
    查看>>
    Position属性四个值:static、fixed、absolute和relative的区别和用法
    查看>>
    POSIX thread编程中关于临界区内条件变量的分析
    查看>>
    POSIX与程序可移植性
    查看>>
    posix多线程有感--自旋锁
    查看>>
    SpringBoot中集成海康威视SDK实现布防报警数据上传/交通违章图片上传并在linux上部署(附示例代码资源)
    查看>>
    POSIX标准和XSI扩展
    查看>>
    post install error,please remove node_moules before retry
    查看>>
    PostGIS中获取所有EPSG的编码以及对应Proj4字符串
    查看>>
    PostGIS在Windows上的下载与安装
    查看>>
    postgis数据库优化_postgresql 性能优化
    查看>>
    Postgres Docker版本安装mysql_fdw 插件
    查看>>
    Postgres invalid command \N数据恢复处理
    查看>>