How to get the file name for <input type=“file” in jsp

后端 未结 2 2028
悲&欢浪女
悲&欢浪女 2021-02-10 22:27

I want to read the file path from html input type=\"file\" (the entry selected in the file dialog by the user)



        
2条回答
  •  有刺的猬
    2021-02-10 23:09

    (Taken from http://www.jguru.com/faq/view.jsp?EID=1045507)

    Solution A:

    1. Download http://www.servlets.com/cos/index.html
    2. Check http://www.servlets.com/cos/javadoc/com/oreilly/servlet/MultipartRequest.html - it has the relevant getter.

    Solution B:

    1. download http://commons.apache.org/fileupload/
    2. invoke readHeaders() in org.apache.commons.fileupload.MultipartStream

    Solution C:

    1. download http://users.boone.net/wbrameld/multipartformdata/
    2. invoke getParameter on com.bigfoot.bugar.servlet.http.MultipartFormData

提交回复
热议问题