0

Currently in my web application i am storing the image file into the database and retrieving it from the Bolb field using a Servlet. But i want to store it into the disk space. I am having this project deployed on the server as a war file. The problem i am facing is, i am unable to provide the location to which the file is to be uploaded.

The folder structure that i am getting on the Panel is

Root directory
.plesk
cgi-bin
error_docs
httpdocs
   img

i have tried to provide the path using this method but got PathNotFound Exception

<context-param>
<description>Location to store uploaded file</description>
<param-name>file-upload</param-name>
<param-value>httpdocs/img/
</param-value>
</context-param>

After reading this link Recommended way to save uploaded files in a servlet application I have got some idea but still facing the problem because i am not having a dedicated server an i am having no control over the server.

Help me to solve this problem

Community
  • 1
  • 1
Ankit Sahu
  • 85
  • 4
  • 17
  • 1
    Stick it in a DB if you can't control the server? – Evan Knowles May 11 '15 at 08:48
  • @EvanKnowles actually i am getting database space 20% of the total disk space. So if will save all files into the database, i have to pay unnecessary for the disk space. – Ankit Sahu May 11 '15 at 09:18
  • Well, you have to put them on disk somewhere. It'll take up disk space if it's in the DB or in a different location somewhere. – Evan Knowles May 11 '15 at 09:29

1 Answers1

1

How about to start from full path like

<param-value>/var/www/vhosts/subscription.name/httpdocs/img/</param-value>
Oleg Neumyvakin
  • 9,706
  • 3
  • 58
  • 62