How to upload Image at specific place or path?

482 Views Asked by At

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 ?

3

There are 3 best solutions below

0
On

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.

0
On

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

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