uploading files

Discussion in 'Java' started by bob@coolgroups.com, Apr 1, 2009.

  1. Guest

    Is there any way to allow users to upload files from their PC in a
    Java applet?
     
    , Apr 1, 2009
    #1
    1. Advertising

  2. On Apr 2, 2:19 am, "" <> wrote:
    > Is there any way to allow users to upload files from their PC in a
    > Java applet?


    Yes.

    Either:
    1) Sign the applet to get access to the local file
    system.
    ...or..
    2) Launch it using the JNLP API (using Java 1.6.0_10+)
    and use the javax.jnlp classes to get access to the
    local file system.

    The server will also need to have some facility to
    accept file uploads.

    --
    Andrew T.
    pscode.org
     
    Andrew Thompson, Apr 1, 2009
    #2
    1. Advertising

  3. Andrew Thompson wrote:
    > On Apr 2, 2:19 am, "" <> wrote:
    >> Is there any way to allow users to upload files from their PC in a
    >> Java applet?

    >
    > Yes.
    >
    > Either:
    > 1) Sign the applet to get access to the local file
    > system.
    > ..or..
    > 2) Launch it using the JNLP API (using Java 1.6.0_10+)
    > and use the javax.jnlp classes to get access to the
    > local file system.
    >
    > The server will also need to have some facility to
    > accept file uploads.
    >
    > --
    > Andrew T.
    > pscode.org


    If he uploads to the server the applet came from, signing is not necessary.

    --

    Knute Johnson
    email s/nospam/knute2009/

    --
    Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
    ------->>>>>>http://www.NewsDemon.com<<<<<<------
    Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
     
    Knute Johnson, Apr 1, 2009
    #3
  4. Arne Vajhøj Guest

    Matt Humphrey wrote:
    > "Knute Johnson" <> wrote in message
    > news:49d397de$0$23152$...
    >> Andrew Thompson wrote:
    >>> On Apr 2, 2:19 am, "" <> wrote:
    >>>> Is there any way to allow users to upload files from their PC in a
    >>>> Java applet?
    >>> Yes.

    >
    >> If he uploads to the server the applet came from, signing is not
    >> necessary.

    >
    > Signing is needed for the applet to read from the local file system.


    Yep.

    Arne
     
    Arne Vajhøj, Apr 2, 2009
    #4
  5. Arne Vajhøj Guest

    wrote:
    > Is there any way to allow users to upload files from their PC in a
    > Java applet?


    A signed applet can:
    * browse and pick one or multiple files
    * upload via HTTP or FTP

    If you are interested in some code to start with (it is not
    production quality) then I have some demo code on the shelf.

    Arne
     
    Arne Vajhøj, Apr 2, 2009
    #5
  6. On Apr 2, 9:57 am, Arne Vajhøj <> wrote:
    > Matt Humphrey wrote:

    ....
    > > Signing is needed for the applet to read from the local file system.

    >
    > Yep.


    I should have been a little more verbose in my
    'option 2' (now trimmed).

    This is the embedded applet using Java 1.6.0_10+
    option, and it can allow even unsigned applets to
    access the local file system. The user is prompted
    for permission at the exact moment the code goes to
    show the file chooser.

    This is in some ways a better user experience than
    the usual 'signed applet', in that
    1) The prompt for extra permissions is more closely
    associated with the user clicking the 'Select File/s
    to Upload' button (whatever).
    2) It is more specific about why the extra permissions
    are required (AFAIR there is mention of something like
    'the code would like to access the local file system
    - Allow Yes/No'
    3) The user can refuse the prompt the first time,
    then change their mind and immediately be prompted
    again (it can be tricky getting a second 'trust prompt' for a signed
    applet that the user has initially
    refused extra permissions).

    Even with the sandboxed/JNLP option, the applet can
    still be signed but sandboxed, and AFAIU, it will
    act just the same (but I have not tested it, since I
    only bother to sign applets when they are not JNLP
    based and require trust).

    --
    Andrew T.
    pscode.org
     
    Andrew Thompson, Apr 2, 2009
    #6
  7. Roedy Green Guest

    On Wed, 1 Apr 2009 09:19:58 -0700 (PDT), ""
    <> wrote, quoted or indirectly quoted someone who
    said :

    >Is there any way to allow users to upload files from their PC in a
    >Java applet?


    If you want to look at files on the local machine, you need to sign
    your Applet. You can talk to the server from which you were loaded
    without signing.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    "Danish studies of 10,000 birds killed revealed that almost all died in
    collisions with buildings, cars and wires; only 10 were killed by windmills.
    Alternative energy sources are absolutely necessary.
    Global warming will kill birds and bats, as well as other species,
    in much greater numbers than wind power."
    ~ Dr. David Suzuki
     
    Roedy Green, Apr 2, 2009
    #7
    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. raymond chiu

    Uploading files to Windows Server

    raymond chiu, Jan 6, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    514
    =?Utf-8?B?Tm90SGVscGZ1bA==?=
    Jan 12, 2006
  2. PJ

    Re: Uploading large files

    PJ, Jun 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,112
  3. Dung Ping
    Replies:
    10
    Views:
    1,020
    Chaddy2222
    Jan 16, 2006
  4. dermoon
    Replies:
    0
    Views:
    500
    dermoon
    Oct 8, 2003
  5. Andrew Chan

    Problems: uploading files have Chinese named files

    Andrew Chan, Apr 16, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    191
    Andrew Chan
    Apr 16, 2004
Loading...

Share This Page