Re: File path passed as parameter

Discussion in 'Java' started by Chris Riesbeck, Aug 15, 2003.

  1. In article <>,
    Archaeopteryx <> wrote:

    >
    >How can I have the user press a button in order to select a directory
    >on its local file system and invoking the servlet passing the
    >directory's complete path as parameter.
    >
    >I thought that I could easily solve the problem with something like:
    >
    ><FORM ACTION="/photoalbum/ImageList" METHOD=GET>
    >Image folder: <INPUT NAME="imagefolder" TYPE="file">
    ><INPUT TYPE="submit" VALUE="Send File">
    ></FORM>
    >
    >but this does not work well because:
    >1) you cannot select directories, only regular files


    You're stuck on that part but can't your servlet deduce the directory
    if the user selects a file in it?

    >2) only the file name and not the complete path is passed in the
    >"imagefolder" parameter.


    Use Javascript to get the full path first and stuff
    it in a hidden form field, e.g., add

    <input type="hidden" name="savedpath">
    ....
    <input type="submit" value="Send File"
    onclick="this.form.savedpath.value=this.form.imagefolder.value">
    Chris Riesbeck, Aug 15, 2003
    #1
    1. Advertising

  2. On Fri, 15 Aug 2003 13:15:33 -0500, Chris Riesbeck <> wrote:
    > In article <>,
    > Archaeopteryx <> wrote:
    >
    >>


    > You're stuck on that part but can't your servlet deduce the directory
    > if the user selects a file in it?


    Yes Chris. It seemed to odd to me at first glance but I understand that
    this is probably the only way.

    > Use Javascript to get the full path first and stuff
    > it in a hidden form field, e.g., add
    >
    ><input type="hidden" name="savedpath">
    > ...
    ><input type="submit" value="Send File"
    > onclick="this.form.savedpath.value=this.form.imagefolder.value">


    This is actually worth a try.
    Thanks.

    Bye



    --
    A.
    Archaeopteryx, Aug 15, 2003
    #2
    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. dee
    Replies:
    9
    Views:
    494
    Joseph Byrns
    Apr 15, 2005
  2. Damon
    Replies:
    2
    Views:
    6,217
    Damon
    Feb 3, 2006
  3. Neomorph
    Replies:
    2
    Views:
    552
    Archaeopteryx
    Aug 16, 2003
  4. Anand
    Replies:
    2
    Views:
    889
    Anand
    Sep 11, 2003
  5. soren625
    Replies:
    10
    Views:
    229
    Kevin Collins
    Dec 28, 2005
Loading...

Share This Page