Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

File Upload using HTML + Servlet

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i am developing one application in which i use simple HTML and at some placeses I am using Servlet.
But I am not able to upload file using servlet.

My code in doPost method
ServletFileUpload.isMultipartContent(request) // returns true

But



then it throws...
java.security.AccessControlException: access denied (java.io.FilePermission . write)


Please help me to solve this....
Thanks...
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the servlet container is running with a security manager that doesn't allow the web app to access directory ".". Keep in mind that web apps do not have a default directory, and so "." will have a very different meaning than you may think it has. Try it with an absolute path that point to a directory within the web app; that is generally allowed by such security managers.
 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:It looks like the servlet container is running with a security manager that doesn't allow the web app to access directory ".". Keep in mind that web apps do not have a default directory, and so "." will have a very different meaning than you may think it has. Try it with an absolute path that point to a directory within the web app; that is generally allowed by such security managers.




Thank you so much...
I got my problem solved....
 
That feels good. Thanks. Here's a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!