-----------------------------------JSP页面------------------------------------------------------
<
form
name
="form1"
method
="post"
action
="SaveFile.do"
enctype
="multipart/form-data"
>
<
tr
bgcolor
="#f7f7f7"
>
<
td
class
="efLb"
rowspan
="3"
width
="12%"
>
附件:
</
td
>
<
td
colspan
="3"
class
="efEditRight"
>
<
input
type
="file"
name
="file1"
size
="35"
></
td
>
</
tr
>
<
tr
bgcolor
="#ffffff"
>
<
td
colspan
="3"
class
="efEditRight"
>
<
input
type
="file"
name
="file2"
size
="35"
>
</
td
>
</
tr
>
<
tr
bgcolor
="#f7f7f7"
>
<
td
colspan
="3"
class
="efEditRight"
>
<
input
type
="file"
name
="file3"
size
="35"
>
</
td
>
</
tr
>
</
form
>
------------------------------------处理--------------------------------------------------- mySmartUpload.initialize(pageContext); mySmartUpload.setTotalMaxFileSize(commonClass.MSG_FILE_SIZE); mySmartUpload.upload(); mySmartUpload.save("../elone/infordp/uploadfile");//保存文件到相对路径 String file1=mySmartUpload.getFiles().getFile(0).getFileName();//获得文件名 String file2=mySmartUpload.getFiles().getFile(1).getFileName();//获得文件名 String file3=mySmartUpload.getFiles().getFile(2).getFileName();//获得文件名 剩下的就是把文件名保存到数据库了
转载请注明原文地址: https://ibbs.8miu.com/read-23911.html