Dear list,
I am relatively new to Java, so be kind !! I have code which uses the
Commons.fileupload bean. We are using Tomcat on a linux server, and
uploading a graphic file, which is then saved into an oracle database. The
file is stored in a temp directory, before being written to the DB.
When the browser-client is windows which is uploading, the file is saved on
the Linux server using "c:\test\sample.jpg" as the file name [ results in
something like i.e. opt/jarkarta/webapps/myapp/tmp/c:\test\sample.jpg ], and
not sample.jpg which would be correct. This leads to real problems.
The problem is probably the parsing of the string sent as a form item. So
when I call the item.getName and output to a command window, I only
get c:\test\sample.jpg.
String fileName = item.getName();
java.io.File file = new File(fileName);
onlyFileName = file.getName();
System.out.println("Stripped down Filename = " + onlyFileName);
// outputs --> c:\test\sample.jpg
I am using then the java File object to parse this file, and I guess it
needs c:\\test\\sample.jpg for it to work (on linux), which if the command
window is not lying is giving me just single backslashes. I am not sure if
the interpreter will automatically replace (behind the scenes) the \ slash
with \\ without us knowing.
I am not sure if I should now begin to use String replace methods and
replace a single \ occurence with \\ or something else, when the client is
windows (determined by using the jsp getHeader()) method.
Would really appreciate any advice on this rather confusing subject.
regards
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]