要哭啦,请问我用JspSmartupload把文件上传到了服务器后,如何把它加入数据库? 毕设害死人,我如何才能把服务器文件夹的文件放入数据库阿,只放路径就好,文件是图片与视频.哭哭 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 简单给你一段代码自己去慢慢看!<%@ page contentType="text/html;charset=GB2312" import="com.jspsmart.upload.*" %><%@ page import="java.sql.*"%><%@ page import="java.util.*" %><%@ page session="true" %><jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><jsp:useBean id="db" scope="page" class="oa.news.opendb" /><html><head><title>文件上传</title></head><body><center>文件上传</center><hr><% String mesg="";String time1="";........ mySmartUpload.initialize(pageContext); mySmartUpload.upload(); int count=0; String a[]=new String[3]; String b[]=new String[3]; for(int i=0;i<mySmartUpload.getFiles().getCount();i++) { File myFile=mySmartUpload.getFiles().getFile(i); if(!myFile.isMissing()) { time=year+"-"+month+"-"+day+i; String filename=time1+"."+myFile.getFileExt(); myFile.saveAs("/upload/"+filename,mySmartUpload.SAVE_VIRTUAL); String path="\\upload\\"; String fileloca=path+filename; a[i]=fileloca; b[i]=myFile.getFileExt(); count++; }else{ a[i]="无"; b[i]="无"; } } ......... String errmsg="添加成功"; author=name+"/"+bm; String sql="insert into news(title,author,content,rq,class,path1,path2,path3,lx1,lx2,lx3) values('"+title+"','"+author+"','"+content+"','"+rq+"','"+type+"','"+a[0]+"','"+a[1]+"','"+a[2]+"','"+b[0]+"','"+b[1]+"','"+b[2]+"')"; db.execQuery(sql); response.sendRedirect("add_news.jsp");}%></body></html> Runtime.getRuntime().exec怪问题? 请问一个字符编码问题 jfreechart问题请教 怎样得到被选中行的某一字段? 有关web的select问题 如何得到此<input type="text" name="aa">的值 有人在IntelliJ IDEA中做过spring integration的开发吗? jsp中表格的格式是什么? servlet下载文件 乱码乱码,为什么? 怎么向服务器请求一幅图片并显示? 循环语句生成的表单之间距离较大,如何消除表单之间的间隔?
import="com.jspsmart.upload.*"
%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*" %>
<%@ page session="true" %><jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<jsp:useBean id="db" scope="page" class="oa.news.opendb" />
<html>
<head>
<title>文件上传</title>
</head><body>
<center>文件上传</center>
<hr>
<%
String mesg="";
String time1="";
........
mySmartUpload.initialize(pageContext);
mySmartUpload.upload();
int count=0;
String a[]=new String[3];
String b[]=new String[3];
for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
{
File myFile=mySmartUpload.getFiles().getFile(i);
if(!myFile.isMissing())
{
time=year+"-"+month+"-"+day+i;
String filename=time1+"."+myFile.getFileExt();
myFile.saveAs("/upload/"+filename,mySmartUpload.SAVE_VIRTUAL);
String path="\\upload\\";
String fileloca=path+filename;
a[i]=fileloca;
b[i]=myFile.getFileExt();
count++;
}else{
a[i]="无";
b[i]="无";
}
} .........
String errmsg="添加成功";
author=name+"/"+bm;
String sql="insert into news(title,author,content,rq,class,path1,path2,path3,lx1,lx2,lx3) values('"+title+"','"+author+"','"+content+"','"+rq+"','"+type+"','"+a[0]+"','"+a[1]+"','"+a[2]+"','"+b[0]+"','"+b[1]+"','"+b[2]+"')";
db.execQuery(sql);
response.sendRedirect("add_news.jsp");
}
%></body>
</html>