jsp上传文件名至数据库

来源:百度知道 编辑:UC知道 时间:2024/06/16 14:43:21
我用jspsmartupload组件上传视频到服务器,想把文件名保存到数据库,不知道怎么保存到数据库,请大侠们指点一下,最好能给段源程序。我很急,马上就要交任务了

你说的是不是不知道怎么样取文件名啊?
在JSP中写:
<jsp:useBean id="smart" scope="page" class="com.jspsmart.upload.SmartUpload"/>
<%
smart.initialize(pageContext) ;
smart.upload() ;

//取得文件名
String fileName = smart.getFiles().getFile(0).getFileName();
smart.save("/uploadfiles") ;
%>

既然你现在有了一个文件名fileName,那么就将它做一个符串保存到数据库中去吧.如果你还没有安装数据库,也没有建立过数据库连接,Google一下或去下面的网址看看吧
http://www.west263.com/info/html/chengxusheji/Javajishu/20080225/34458.html