代码如下:
<%
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的服务器,就不能上传了,服务提供商也不知道是哪里出错或哪里设置不对。
请各位高手帮忙指点一下,万分感谢!!!

解决方案 »

  1.   

    应该是权限的问题啊 access denied -------------》拒绝访问
      

  2.   

    通过LeapFTP看到,uploadTest文件夹Owner、Group、World的Read、Write、Execute权限都是勾上了的。
    是否是Linux服务器还要做什么设置?
      

  3.   

    如果改为:
    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)