• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save image from Servlet

 
Isaac Ferguson
Ranch Hand
Posts: 1029
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to save an image from a Servlet like this:



It works well in this case but I want to save the pics in a folder called pics inside the WebPages folder like this:



Any idea, please?

Regards, Isaac
 
salvin francis
Bartender
Posts: 1335
11
Eclipse IDE Google Web Toolkit Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do you want to save it in the webpages folder ?
Consider this, you want to deploy a new war to the server, what is going to happen ?

By the way, you might want to look at ServletContext.getRealPath() method.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saving anything into the web context is a really bad idea as has already been pointed out. It will create many problems when redeploying. Save any files outside the web context.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic