Re: File path passed as parameter

Discussion in 'Java' started by Neomorph, Aug 15, 2003.

  1. Neomorph

    Neomorph Guest

    On Fri, 15 Aug 2003 08:37:32 GMT, Archaeopteryx <>
    two-finger typed:

    >
    >Hello.
    >I'm developing a servlet showing picture
    >files with various options: a sort of photoalbum servlet.
    >
    >I solved the problems related with loading images from disk and
    >displaying them with scaling options (for thumbnailing and the like).
    >
    >Now I need to build some user interaction around: the directory
    >containing the image files is hardcoded as servlet parameter in the
    >starting page invoking the servlet.
    >
    >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.


    Since a Servlet cannot scan/read a user's local directory for files, there
    is no sense in sending a (local) directory path to the servlet.
    Only specifically selected files can be uploaded.

    Have a look at geocities with their web interface for webpage management
    (you need to have an account or make a new one - it's free, though).

    >
    >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
    >2) only the file name and not the complete path is passed in the
    >"imagefolder" parameter.


    The reason for this has to do with information hiding with respect to
    secure web usage.

    >
    >I.e.: if I select the /home/foo/bar file, the servlet is invoked as:
    >
    >http://localhost:8080/photoalbum/ImageList?imagefolder=bar
    >
    >instead of:
    >
    >http://localhost:8080/photoalbum/ImageList?imagefolder=/home/foo/bar
    >
    >
    >This is probably because the above snippet is to be used when
    >uploading files to the server.
    >
    >
    >
    >Thanks in advance for any hint.


    If you want to be able to upload a number of images, why not support a
    single zip file ?

    Cheers.
     
    Neomorph, Aug 15, 2003
    #1
    1. Advertising

  2. On Fri, 15 Aug 2003 14:39:08 +0200, Neomorph <> wrote:

    > Since a Servlet cannot scan/read a user's local directory for files, there
    > is no sense in sending a (local) directory path to the servlet.
    > Only specifically selected files can be uploaded.
    >


    I do not need to upload any file: the servlet
    container (namely Tomcat) will run on the same machine as the client's
    the server will reach the directory path passed by the client without any problem.

    I only need to tell the servlet where to look for pic files.


    > If you want to be able to upload a number of images, why not support a
    > single zip file ?
    >
    > Cheers.


    No need to upload as explained above.

    Thanks anyway

    Ciao

    --
    A.
     
    Archaeopteryx, Aug 15, 2003
    #2
    1. Advertising

  3. On Sat, 16 Aug 2003 01:46:58 +0200, Neomorph <> wrote:
    [BIG SNIP]
    > (rehash here)
    > Then you need to assume that the tree the client is browsing is a directory
    > tree on the server side (whether it's on the same machine or not - since
    > that is not a distinction you can make in client/server programming).
    >
    > Cheers.


    I got your point Neomorph.
    I actually started using the servlet approach since it's my first try
    with this kind of technology.

    But implementation constraints are pushing me to modify the
    architecture of the application: I'll take into account your hints.

    Thanks

    Bye



    --
    A.
     
    Archaeopteryx, Aug 16, 2003
    #3
    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:
    537
    Joseph Byrns
    Apr 15, 2005
  2. Damon
    Replies:
    2
    Views:
    6,268
    Damon
    Feb 3, 2006
  3. Chris Riesbeck

    Re: File path passed as parameter

    Chris Riesbeck, Aug 15, 2003, in forum: Java
    Replies:
    1
    Views:
    369
    Archaeopteryx
    Aug 15, 2003
  4. Anand
    Replies:
    2
    Views:
    934
    Anand
    Sep 11, 2003
  5. soren625
    Replies:
    10
    Views:
    263
    Kevin Collins
    Dec 28, 2005
Loading...

Share This Page