Hello,
I have written a servlet to upload files to a network drive. I've
tried to use the UNC pathname but it doesn't work. The message that I
receive is :"...FileNotFoundException...access denied". With a normal
pathname (e.g. d:\InetPub\upload ) it works without problems.
In this example, you can see basicaly what I've done . I've omitted
great part of the code because the problem is here.
(Platform is Intel Windows NT 4.0 Server, running Apache 1.3.6 with
JServ 1.0 B3)
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out = res.getWriter();
try
{
String strTest = new String("Testing UNC with OutputStream ");
byte buffer[] = null;
buffer = strTest.getBytes();
File file = new File("\\\\gws1\\InetPub\\testit.txt");
FileOutputStream fout= new FileOutputStream (file);
fout.write(buffer);
fout.close();
catch (Exception e)Quote:}
{
out.println(e.toString());
....Quote:}
I have tried various variations of the FileOutputStream consturctor,
i.e. with a String paramater (either drive-mapped or UNC names, with
both doubled back-slashes or forward slashes), or as File object.
If anyone could offer any advice, I would be extremely grateful!
Thanks,
Manuel Burgada