YouVIP 2017-03-19 01:46 采纳率: 33.3%
浏览 4750

getSubmittedFileName();报错

Part photo1= request.getPart("photo");
String photo= photo1.getSubmittedFileName();

getSubmittedFileName();报错:
    The method getSubmittedFileName() is undefined for the type Part
  • 写回答

1条回答 默认 最新

  • 追着梦跑 2017-08-15 07:57
    关注

    在tomcat7 的环境下就没有part.getSubmittedFileName()这一方法,无法直接获取文件名。
    String cd = part.getHeader("Content-Disposition");
    //截取不同类型的文件需要自行判断
    String filename = cd.substring(cd.lastIndexOf("=")+2, cd.length()-1);

    评论

报告相同问题?

悬赏问题

  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥20 jupyter保存图像功能的实现
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键