开发者

jsp file upload location

开发者 https://www.devze.com 2023-03-14 21:16 出处:网络
hi i am uploading my images using the String filePath = context.getRealPath(\"/\")+\"/Library/\"; all of the images are get to saved in

hi i am uploading my images using the

String filePath = context.getRealPath("/")+"/Library/";

all of the images are get to saved in

.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/

when i list the files in

.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/

from terminal i can see the images that were uploaded. but if i list the files in

.../workspace/MyProj/Library/

i cannot see them. also from eclipse (inside project explorer)

MyProj
->Library

i cannot see the images uploaded. then i thought probably that location is kind of temp location, and restarted my computer. but uploaded images are still in

.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyPr开发者_开发技巧oj/Library/

but through eclipse they are not visible, doing file->refresh also did not help. my questions are follows will the uploaded images stay in this location

.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/

and why i cannot see them from eclipse? if it is possible can you show me how to save them directly in

.../workspace/MyProj/Library/

thanks!


You can't see the images because eclipse has deployed your webapp to a server and your images are being uploaded to the server.

You can save them directly to your workspace by using:

System.getEnv("user.home")+"/workspace/MyProj/Library/"

instead of:

context.getRealPath("/")+"/Library/";
0

精彩评论

暂无评论...
验证码 换一张
取 消