my dog learned polymorphism*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How to specify file Url in applet" Watch "How to specify file Url in applet" New topic
Author

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.


Regards,
Pankaj Patil
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8876
    
    8

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to specify file Url in applet