java.security.AccessControlException access denied (java.io.FilePermission
843811Jan 3 2004 — edited Jan 18 2004When I try 2 upload a file using Fileupload framework, I am getting error
"java.security.AccessControlException : access denied (java.io.FilePermission
/home/virtual/site50/fst/var/www/html/tmp/upload_00000012.tmp delete)".
I host my site in Tomcat Server which is running on Redhat Linux.
In my root I created 'tmp' directory and I set the reposity path using
DiskFileUpload.setRepositoryPath(getServletContext().getRealPath("/") + "tmp");
I have given all the permissions(read,write,execute,delete) to the 'tmp' directory.
file permission for 'tmp' directory--------- drwxrwxrwx
Code I used to upload file :
DiskFileUpload upload = new DiskFileUpload();
List items = upload.parseRequest(request, 1024*1024*2, 1024*1024*4, getServletContext().getRealPath("/") + "tmp" );
Iterator itr = items.iterator();
while(itr.hasNext()){
FileItem item = (FileItem) itr.next();
if(!item.isFormField())
{
// the item must be an uploaded file
File tmp = new File(getServletContext().getRealPath("/") + "tmp");
File fullFile = new File(item.getName());
filename = item.getName();
File savedFile = new File(tmp, fullFile.getName());
item.write(savedFile);
can any one solve this problem
Please send your reply to infomarni0@yahoo.co.in
Thanks in advance