Simple HTML/JSP/Java question

J

Jim Kyle

Hi,

I have a simple problem and am looking for a potential solution.

I have a web page that requests user input in the form of a
<input type="file" name="addFilePath" maxlength="250" size="50"
value="">

When this data is stored I want it stored as a UNC file path/name.
What would be the java code to do this for a Windows 2000
machine/network.

Thanks,
J
 
C

Chris Smith

Jim said:
I have a simple problem and am looking for a potential solution.

I have a web page that requests user input in the form of a
<input type="file" name="addFilePath" maxlength="250" size="50"
value="">

When this data is stored I want it stored as a UNC file path/name.
What would be the java code to do this for a Windows 2000
machine/network.

I'm not sure you understand what the HTML above actually does. The data
that will be sent when this form is submitted is the actual contents of
whatever file was entered in the input field. You do get basic filename
information, but not enough to build a UNC name for the file. (For
example, you don't get the list of file shares on the source system that
might include the resource.)

You could always store it on the server itself, and then store a UNC
name for the copy. You'd still need to assume some information that's
not available to Java without native code (because it's not portable)...
or you could write the native code to find out, of course!

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
J

Jim Kyle

Chris Smith said:
I'm not sure you understand what the HTML above actually does. The data
that will be sent when this form is submitted is the actual contents of
whatever file was entered in the input field. You do get basic filename
information, but not enough to build a UNC name for the file. (For
example, you don't get the list of file shares on the source system that
might include the resource.)

You could always store it on the server itself, and then store a UNC
name for the copy. You'd still need to assume some information that's
not available to Java without native code (because it's not portable)...
or you could write the native code to find out, of course!

Thanks for the information. I have seen the VB or C++ code calling an
API of WNetGetConnection. I guess I will have to try and figure out
how to do this in Java. What is the best way to convert or ensure the
file name saved from the HTML is a UNC name?
 
C

Chris Smith

Jim said:
Thanks for the information. I have seen the VB or C++ code calling an
API of WNetGetConnection. I guess I will have to try and figure out
how to do this in Java. What is the best way to convert or ensure the
file name saved from the HTML is a UNC name?

Java doesn't provide that capability. You will need to make use of some
OS-specific means of finding it. (That makes sense, since it's an OS-
specific concept and the Java API is cross-platform.) So, you'll likely
actually end up writing this code in VB or C++ (and use that
WNetGetConnection if that is indeed the best way to get the information
from your native language), and then connect the native code to a Java
API using JNI. So, for the Java side of this, look for a tutorial on
JNI; there are probably plenty on the web.

Alternatively, you could check out JConfig. There's a possibility that
information is available through JConfig on Windows.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top