How to upload Image at specific place or path?

孤街醉人 提交于 2020-01-03 06:39:20

问题


I am trying to upload Image but I can't. When my application is in local disk i.e. d:\ then it works. But when I put my application on out office server and when I am trying to upload image then it isn't working. Before I am using following path :

final String path = "D:\\Workspace\\B2B Solution\\WebContent\\product_images\\";

now my application reside at :

\\ADMIN\keyur\Workspace\B2B Solution\WebContent\product_images

place i.e. on network. So which address I have to pass in servlet I don't know.

Any help please ?


回答1:


Probably you need to create the path like this:

File fp = new File("\\\\ADMIN\\keyur\\Workspace\\B2B Solution\\WebContent\\product_images");

You need to escape all the slashes in the path.

Another option is to use the third party JCIFS API to create a connection through Samba to the network share; that also gives you control over which user is used to connect to the share which might be helpful.




回答2:


start your path with "..\Workspace\B2B Solution\WebContent\product_images" dont use full path



回答3:


In That case you need to check your path. With correct path you will not get any problem.



来源:https://stackoverflow.com/questions/20492020/how-to-upload-image-at-specific-place-or-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!