我已经创建了一个java Web应用程序,并且已经在服务器上部署了war文件。我在我的Web应用程序中有一个文件上载机制。我正在使用上下文路径传递要存储的文件的路径 下面给出的代码我在我的本地服务器上
<context-param>
<description>Location to store uploaded file</description>
<param-name>file-upload</param-name>
<param-value>E:\my work\Tomcat\webapps\images
</param-value>
</context-param>
此代码工作正常,因为图像存储在本地磁盘位置但是当我更改远程服务器的位置时问题就开始了
<context-param>
<description>Location to store uploaded file</description>
<param-name>file-upload</param-name>
<param-value>httpdocs/img/
</param-value>
</context-param>
我在将代码部署到远程主机之前更改了代码,我的目录结构如下
Root directory
.plesk
cgi-bin
error_docs
httpdocs
logs
After uploading the file i am getting the following exception
java.io.FileNotFoundException: httpdocs\img\ankit.jpg (The system cannot find the path specified) at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source)
at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:416)
所以我的问题是我应该提供什么样的途径来摆脱这个问题。