Writing To A Protected Directory - TechRepublic
General discussion
May 22, 2006 at 01:30 PM
elias_barreto

Writing To A Protected Directory

by elias_barreto . Updated 20 years, 1 month ago

I am trying to write a file to a protected directory on a file server in java. My code looks like this:

HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
PrintWriter out = httpResponse.getWriter();

File write = new File(“\\\\nyfs1.imclone.com/research/Shared/Sciop/” + fname);
OutputStream fileOut = new FileOutputStream(write);
fileOut.write(buffer);

I am getting a handle invalid error. Then it says file can’t be found. If I write to a public folder, the file gets written to just fine. How would I provide the credentials (username and password) so that I can write the file to the directory?

This discussion is locked

All Comments