代码如下:
<%
try { int count=0; // Initialization
mySmartUpload.initialize(pageContext); mySmartUpload.setAllowedFilesList("jpg,JPG,jpeg,JPEG,bmp,BMP,gif,GIF,tif,TIF,tiff,TIFF,psd,PSD"); mySmartUpload.setTotalMaxFileSize(6000000); // Upload
mySmartUpload.upload(); // Save the files with their original names in the virtual path "/upload"
// if it doesn't exist try to save in the physical path "/upload"
count = mySmartUpload.save(getServletContext().getRealPath("/")+"/caricature/caricatureorder/step1/uploadTest/");
// Save the files with their original names in the virtual path "/upload"
// count = mySmartUpload.save("/upload", mySmartUpload.SAVE_VIRTUAL); // Display the number of files uploaded
out.println("<script language='javascript'>alert('Success! " + count + " file(s) uploaded');parent.document.all.spUpFont.style.display='none';parent.document.frmHYDJ.txtFile1.value = parent.document.FileFrm1.photo1.value;parent.document.frmHYDJ.txtFile2.value = parent.document.FileFrm1.photo2.value;parent.document.frmHYDJ.txtFile3.value = parent.document.FileFrm1.photo3.value;</script>");
//out.println(count + " file(s) uploaded. by test"); } catch (Exception ex) {
out.println("<script language='javascript'>alert('Lose! " + ex.toString() + "(We only accept:jpg,jpeg,bmp,gif,tif,tiff,psd)');parent.document.all.spUpFont.style.display='none';parent.document.all.spUpload.style.display='';</script>");
out.println(ex.toString() + "<br>");
}
%>错误提示为:
jspSmartUpload : Sample 1--------------------------------------------------------------------------------
java.security.AccessControlException: access denied (java.io.FilePermission /var/chroot/home/content/o/s/o/osoqnet/html/caricature/caricatureorder/step1/uploadTest/10bea24da4c.jpg write)
程序是在外网上运行,以前服务器用的是WINDOWS的系统,上传一直都没问题。最近换了Linux的服务器,就不能上传了,服务提供商也不知道是哪里出错或哪里设置不对。
请各位高手帮忙指点一下,万分感谢!!!
<%
try { int count=0; // Initialization
mySmartUpload.initialize(pageContext); mySmartUpload.setAllowedFilesList("jpg,JPG,jpeg,JPEG,bmp,BMP,gif,GIF,tif,TIF,tiff,TIFF,psd,PSD"); mySmartUpload.setTotalMaxFileSize(6000000); // Upload
mySmartUpload.upload(); // Save the files with their original names in the virtual path "/upload"
// if it doesn't exist try to save in the physical path "/upload"
count = mySmartUpload.save(getServletContext().getRealPath("/")+"/caricature/caricatureorder/step1/uploadTest/");
// Save the files with their original names in the virtual path "/upload"
// count = mySmartUpload.save("/upload", mySmartUpload.SAVE_VIRTUAL); // Display the number of files uploaded
out.println("<script language='javascript'>alert('Success! " + count + " file(s) uploaded');parent.document.all.spUpFont.style.display='none';parent.document.frmHYDJ.txtFile1.value = parent.document.FileFrm1.photo1.value;parent.document.frmHYDJ.txtFile2.value = parent.document.FileFrm1.photo2.value;parent.document.frmHYDJ.txtFile3.value = parent.document.FileFrm1.photo3.value;</script>");
//out.println(count + " file(s) uploaded. by test"); } catch (Exception ex) {
out.println("<script language='javascript'>alert('Lose! " + ex.toString() + "(We only accept:jpg,jpeg,bmp,gif,tif,tiff,psd)');parent.document.all.spUpFont.style.display='none';parent.document.all.spUpload.style.display='';</script>");
out.println(ex.toString() + "<br>");
}
%>错误提示为:
jspSmartUpload : Sample 1--------------------------------------------------------------------------------
java.security.AccessControlException: access denied (java.io.FilePermission /var/chroot/home/content/o/s/o/osoqnet/html/caricature/caricatureorder/step1/uploadTest/10bea24da4c.jpg write)
程序是在外网上运行,以前服务器用的是WINDOWS的系统,上传一直都没问题。最近换了Linux的服务器,就不能上传了,服务提供商也不知道是哪里出错或哪里设置不对。
请各位高手帮忙指点一下,万分感谢!!!
解决方案 »
- 请问如何提示操作成功并关闭窗口?
- struts2无法运行 tomcat出现异常 严重Error filterStart
- 怎样在状态栏里隐藏链接??
- 关于配置文件
- 下面这两段程序我认为没有问题呀,可是为什么会有错误?
- 请各位高手帮忙看看这段servlet连接数据库的程序,急!!!!!
- 一个jsp连接sqlsever2000的问题?
- 日期函数!!!!!!!!!!!!!!!!!
- 一个很幼稚的问题,请各位高手帮帮我(在线等待)!!!!!
- 请教我在MYSQL里建一个表,并且自己能查看表,然后可以用JSP调用表里的记录???
- 高手一定要帮忙啊!!!!!!!!!!!!
- ====急问请求高手====关于ssl连接submit提交失败的问题
是否是Linux服务器还要做什么设置?
count = mySmartUpload.save(getServletContext().getRealPath("/")+"/caricature/caricatureorder/step1/asdfasdf(不存在的文件夹)/");
报错为:
java.lang.IllegalArgumentException: This path does not exist (1135).如果改为:
count = mySmartUpload.save("/upload");
报错为:
java.security.AccessControlException: access denied (java.io.FilePermission /upload read)