Simple HTML/JSP/Java question

Discussion in 'Java' started by Jim Kyle, Jan 21, 2004.

  1. Jim Kyle

    Jim Kyle Guest

    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
    Jim Kyle, Jan 21, 2004
    #1
    1. Advertising

  2. Jim Kyle

    Chris Smith Guest

    Jim Kyle wrote:
    > 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
    Chris Smith, Jan 21, 2004
    #2
    1. Advertising

  3. Jim Kyle

    Jim Kyle Guest

    Chris Smith <> wrote in message news:<4.net>...
    > Jim Kyle wrote:
    > > 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!


    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?
    Jim Kyle, Jan 22, 2004
    #3
  4. Jim Kyle

    Chris Smith Guest

    Jim Kyle wrote:
    > 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
    Chris Smith, Jan 22, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DigitalUncle
    Replies:
    0
    Views:
    899
    DigitalUncle
    Nov 2, 2004
  2. Replies:
    3
    Views:
    497
    Roedy Green
    Jan 23, 2006
  3. Replies:
    0
    Views:
    4,350
  4. Replies:
    2
    Views:
    507
  5. zalek
    Replies:
    1
    Views:
    359
Loading...

Share This Page