毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> java技术 >> 正文

java.lang.IllegalArgumentException: This path does not exist (1135)

更新时间:2012-9-24:  来源:毕业论文

1...
function init()
  {
  uploadInit(document.forms[0].companyPic1,document.forms[0].upimg1,document.forms[0].delimg1);
  }


<table width="85%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  <td width="50%" height="15" align="left" class="cs1"> 请上传企业营业执照副本复印件(加盖公章) 
  <span class="hei12">
  <font color="#FF9933"> </font>
  </span>
  </td>
  <td width="40%" align="left" class="cs1">
  <html:text property="companyPic1" readonly="true" size="25"/>
  </td>
  <td width="20%" align="left" class="cs1">
  <table width="180" height="19" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  <td width="70" align="center" valign="middle" class="cs1">
  <input name="upimg1" type="button" value="上传" onClick="addFile(document.forms[0].companyPic1,this,document.forms[0].delimg1);" class="button4"/>
  </td>
  <td width="110" align="left" class="cs1">
  <input name="delimg1" type="button" value="删除" onClick="delFile(document.forms[0].companyPic1,this,document.forms[0].upimg1);" class="button4"/>
  </td>
  </tr>
  </table>

2....
function addFile(obj,dsb,enb)
{
f = window.showModalDialog("upfile.jsp","","dialogHeight:200px;dialogWidth:400px;center:Yes;help:No;resizable:No;status:no","");
  if(f && f != "")
  {
  obj.value = f;
  dsb.disabled = true;
  enb.disabled = false;
  }
}

3....

<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</head>
<body topmargin="15" >

<form name="f1" method=post action="uploadfile.jsp" Enctype="multipart/form-data">
<input type="hidden" name="uploadType" value="<%=request.getParameter("uploadType")%>"> 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
  <td align=left><font class="font12">添加附件:</font>使用此网页可上载附件。<br>请单击下面的“浏览...”按钮,选择附件。</td>
  </tr>
</table>
<table border="0" width="100%" cellpadding=0>
  <tr>
  <td width="100%" style="background-color: #7595ea;" height="1"><img src="images/blank.gif" width="1" height="1"></td>
  </tr>
  <tr>
  <td>
  <table cellpadding=5 width=100%><tr><td>
<font class="font9">选择附件</font><br>
<input type="file" id="img" class="file" name="img" onKeyDown="return false" oncontextmenu="return false" runat="server">
<br>
</td></tr></table>
  </td>
  </tr>
  <tr>
  <td width="100%" style="background-color: #7595ea;" height="1"><img src="images/blank.gif" width="1" height="1"></td>
  </tr>
  <tr>
  <td width="100%" align=right>
<INPUT type="button" value="确 定" class="button" onClick="checkv();">
<INPUT type="reset" value="取 消" class="button" onClick="window.close();">
  </td>
  </tr>
</table>
</form>
</body>
</html>
<script language=javascript>
function checkv()
{
var fv=f1.img.value;
if(fv=="")
{
alert("请选择要上传的文件!");
return false;
}
document.forms[0].submit();

4....

<%@ page contentType="text/html; charset=GBK" %>
<jsp:useBean id="myUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />

<%
try
{
int count=0;
String fileName = "";
String path = request.getRealPath("/upload")+"\\";
myUpload.initialize(pageContext);
//String strTemp = "";
myUpload.upload();
for (int i=0;i<myUpload.getFiles().getCount();i++)
{
com.jspsmart.upload.File myFile = myUpload.getFiles().getFile(i);
if (!myFile.isMissing())
{
// Save the files with its original names in a virtual path of the web server
fileName = myFile.getFileName();
//int j=0;
//strTemp = fileName;
//String strRealName = fileName.substring(0,fileName.indexOf("."));
String extendName = fileName.substring(fileName.lastIndexOf("."));//扩展名
fileName = System.currentTimeMillis() + extendName;
//File fUp = new File(path + fileName);
//out.println(path);
myFile.saveAs(path + fileName);
count ++;
}
}
%>
<script type="text/javascript">
window.opener.returnValue="<%=fileName%>";
window.opener.close();
window.close();
</script>
<%
}
catch (Exception err)
{
out.println("出错了!"+err.getMessage());
err.printStackTrace();
}

%>
报的错是:java.lang.IllegalArgumentException: This path does not exist (1135).
  at com.jspsmart.upload.SmartUpload.getPhysicalPath(SmartUpload.java:1089)
  at com.jspsmart.upload.File.saveAs(File.java:91)
  at com.jspsmart.upload.File.saveAs(File.java:65)
  at org.apache.jsp.uploadfile_jsp._jspService(uploadfile_jsp.java:77)
  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
  at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  ........................................ 太长了,不让帖。
 
String path = request.getRealPath("/upload")+"\\";
问题肯定是处在这里
这里你先可以这样,String path = "file://c:/temp/……"
直接用这种方式指定目录,然后看程序能否OK,然后再仔细去查你的写法问题 
在myFile.saveAs(path + fileName); 前把path打印出来,看看对不对,然后再看看这个path对应的目录是否存在,如果不存在就先创建这个目录。

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。