File upload script

Thomas Guettler pan-newsreader at thomas-guettler.de
Tue Sep 17 13:46:59 EDT 2002


On Tue, 17 Sep 2002 14:26:38 +0200, Steinar Dragsnes wrote:

> Hi!
> 
> I'm a complete newbe in python and have never written anything more
> advanced then the classical Hallo World example. I have already
> programmed an applet where users should be able to upload images and or
> other files from their local pc. This is of course not possible due to
> the applet security model (sandbox) in Java. But I can start a
> python-script from the running java applet which can do the actual file
> upload for me and save the file to a specific directory on the apache
> server.
> 
> Since the applet that needs the information about what file has been
> uploaded into what node, I need a way to send back information to the
> applet calling the script. I wonder if this is possible at all? Usually
> scripts generate html-pages and call applets from there on they fly,
> with the right paranemer tag values. Is this possible when the applet is
> already running? Would it not destroy the applet context?

I am not a java applet expert, but one thing should be possible:
the Java applet can open an URL on the webserver. This server-side
generated page contains information which file was uploaded to the server


> My main problem is that I do not know how I can pass the parameters of
> type String; sessionID, userID and nodeID, from the appleten to the
> called python-script. I need to know how to write a function that will
> receive these parameters. The python script below is written by a
> colleague of mine, and he is now on a sick-leave....and I need to figure
> this out soon....
> 
> In the java code I call the upload.py script like this:
>      java.net.URL url=new
> java.net.URL("http://"+ip+"/cgi-bin/upload.py");
>     applet.getAppletContext().showDocument(url,"_blank");


Try something like this: url="http:/foo/upload.py?id=" + id + "&nodeID="
+ nodeID ....

 thomas



More information about the Python-list mailing list