File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes How to specify file Url in applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How to specify file Url in applet" Watch "How to specify file Url in applet" New topic

How to specify file Url in applet

pankaj patil
Ranch Hand

Joined: Dec 19, 2004
Posts: 98
I recorded the voice on applet and store it in byte array.Now i want to write this in a file on server through applet.When i specify the address as,

String filename ="http://Gphapale:8080/ajit.txt";// location where the file is to be saved
FileOutputStream fileOutS = new FileOutputStream(filename);
I get following Error message:
ERROR : Exception "http:\localhost:8080\sample.txt (The filename, directory name, or volume label syntax is incorrect)" Occured.

Is there any way to specify the filename so that it get store in tomcat root directory.

Pankaj Patil
Joe Ess

Joined: Oct 29, 2001
Posts: 9191

FileOutputStream is for use with a filesystem, not the HTTP protocol. You need some more work to move things across the network. The Apache Jakarta project has a class called HttpClient which does multipart form uploads and O'reilly has a multipart handler for the server side. That should get you pointed in the right direction.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: How to specify file Url in applet
It's not a secret anymore!