uploading files

A

Andrew Thompson

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

Knute Johnson

Andrew said:
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.

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

Arne Vajhøj

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
 
A

Andrew Thompson

Matt Humphrey wrote: ....

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).
 
R

Roedy Green

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top