Rather than using html requests (I only assume this because you're talking
about multipart and such things) I would suggest that you have the servlet
listening on a socket. Connect to that socket with the applet and then send
the files in and out with byte streams. As long as you're not behind a
firewall then this would be the best I think.
If you, or your projected users, are behind a firewall then you may have to
resort to HTML and do what the previous poster told you.
Hope this helps!
Matt
Quoting Bo Xu <[EMAIL PROTECTED]>:
> Sohaila Roberts wrote:
>
> > Hi, I'm trying to figure out how to go about creating a servlet that
> > uploads a file whose filename has been gotten by an applet, which
> then
> > connects to the servlet. I've looked through the archive's multple
> pages
> > of file upload questions and i'm still confused. I've even gone
> through
> > the MultipartRequest example in the java servlet book by oreilly..
> >
> > I just want the user to click a button, enter/select the filename,
> applet
> > connects to servlet, applet sends filename to servlet, servlet
> uploads
> > file and stores it as a 'File', servlet connects to database and
> chucks it
> > in there. I've got everything thing working except the 'servlet
> uploads
> > file and stores it as a File'.
> >
> > Any suggestions as to whether i can do this, and if I can how do I do
> it?
> >
> > After I figure out how/if this is possible I'm then going to have to
> > figure out the reverse (user tells applet they want to down load
> > file, enters filename, applet sends file name to servlet, servlet
> > tells database to chuck out file to servlet, servlet downloads file
> to
> > user)
> >
> > Thanks in advance :)
> >
> > Sohaila
> > [...]
>
> good reference email for you :-)
>
> ************************************************************
> You'll need to package your data in a MIME message. There may be
> something
> in the O'Reilly package for that; if not, you can use JavaMail,
> available
> at,
> http://java.sun.com/products/javamail/index.html
>
> Look specifically at the javax.mail.internet package, and all the
> Mime*
> classes.
>
> -- Bill K.
>
> > -----Original Message-----
> > From: Bo Xu [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 11, 2001 8:07 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Posting "multipart/form-data"
>
>
> ... I can use multipart/form-data with Jason Hunter's API
> > com.oreilly.servlet.MultipartRequest, in the client I use a HTML
> Form
> > from his book...
>
> > now I want to upload a file to MyServlet from a Java Application(or
> > a Java Applet), I guess I need to use (Http)URLConnection,
> > but I don't know how to use it...
>
> > Bo
> > may.11, 2001
> ****************************************************************
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html