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. Advertisements

  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. Advertisements

  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. Advertisements

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:
    584
    =?Utf-8?B?Tm90SGVscGZ1bA==?=
    Jan 12, 2006
  2. Rosie Chua

    Uploading files up to 150MB onto server

    Rosie Chua, Jun 26, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    3,627
    Russ Bishop
    Jun 26, 2003
  3. Phong Pham

    Uploading large files

    Phong Pham, Jul 1, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    505
    Steve C. Orr, MCSD
    Jul 1, 2003
  4. Steve

    Uploading Files - help please

    Steve, Jul 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    371
    Vidar Petursson
    Jul 16, 2003
  5. Brian Pittman

    wrapper function for uploading files

    Brian Pittman, Jul 30, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    621
    Kevin Spencer
    Jul 30, 2003
  6. Dung Ping
    Replies:
    10
    Views:
    1,368
    Chaddy2222
    Jan 16, 2006
  7. dermoon
    Replies:
    0
    Views:
    628
    dermoon
    Oct 8, 2003
  8. Andrew Chan

    Problems: uploading files have Chinese named files

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