开发者

Upload a zip file, unzip and read file

i am using NetBeans, and i am working on a jsp page that allows the upload of a zip file. The zip file contains 6 CSV files, that is to be written to the SQL database.

My question is, how do i go about allowing the user to upload the file, unzip it in the jsp page, and allo开发者_运维百科w me to read the file? Thanks in advance!


  1. Add an <input type="file"> and make your form have enctype="miltipart/form-data"
  2. Use commons-fileupload to obtain the byte[] of the file (in a servlet of yours)
  3. Use java.util.zip.* to extract the files. See here
  4. Either parse the CVS (here) or if your database has an utility to import CSV, pass the files using Runtime.exec(..)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜