File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applets" Watch "Applets" New topic


Manoj Paul
Ranch Hand

Joined: Jan 18, 2007
Posts: 112
Hi friend
Can anyone help me out with codes for uploading an image file in the server from my Applet page?

I need help in developing an applet which while execution will ask the user to upload his/her image... PLiz send me some codes for developing such an applet application..
Thank you friends
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
First of all the applet needs to be allowed to access the local filesystem. The HowCanAnAppletReadFilesOnTheLocalFileSystem FAQ page describes the two principal ways to do that.

How to proceed then depends on what kind of server you have. If it's FTP, then you do the upload via Commons Net. If it's HTTP (i.e., a servlet will receive the file), then you need Commons HttpClient in the applet, and Commons FileUpload in the servlet.

All these libraries are linked in the FileUpload FAQ page

Joined: Apr 12, 2007
Posts: 1
hello ranchfolk,

I installed the
File Upload Applet and played aroung a little bit.

still, I could not make the parameter "postURL" work because I don't know how to apply it's syntax: http://localhost:8080/jupload/pages/parseRequest.jsp?URLParam=URL+Parameter+Value

I tried <PARAM NAME = "postURL" VALUE ="http://localhost:8080/jupload/pages/parseRequest.jsp?URLParam=http://localhost:8080/jupload/uploaded">

but this doesn't work.

does someone know how to apply the syntax 'URLParam=URL+Parameter+Value'?

thank you a lot.

[ April 15, 2007: Message edited by: patric ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Hello "patric"-

Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, the javadocs for UploadPolicy state that " It contains the target URL toward which the files should be upload." So in your case I'm guessing that it might be something like "http://localhost:8080/jupload/pages/parseRequest.jsp", or wherever the server component is installed.
I agree. Here's the link:
subject: Applets
It's not a secret anymore!