if i were to read an audio file and do the POST to servlet with name value
pair .. name been the name of the audio file and value been the content of
the audio file, how would i do that? the servlet does a get parameter on the
name and thereby extracts the contents of the audio file as a string object.
the servlet then copies the string into a file to regenerate the audio file
at the server side.
how can i do this? i tried the following code but the file created at the
server was corrupt audio file. i DONT want to use multipart to do the file
content transfer.
any help will be of immense help.
sathish
*********************************************
import java.net.*;
import java.io.*;
import java.util.*;
public class DoPOST
{
HttpURLConnection connection = null;
public DoPOST()
{
try
{
URL t_url = new
URL("http://192.138.90.31/servlet/DummyRecordServlet");
connection = (HttpURLConnection)t_url.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setDoInput(true);
PrintStream out = new
PrintStream(connection.getOutputStream());
out.print("eight.wav=");
FileInputStream fis = new FileInputStream(new
File("eight.wav"));
int temp1;
while((temp1=fis.read())!=-1)
{
out.print(temp1);
}
out.close();
BufferedInputStream bis = new
BufferedInputStream(connection.getInputStream());
int temp;
while((temp=bis.read())!=-1)
{
System.out.print((char)temp);
}
}
catch (IOException e)
{
System.out.println("IO exception");
}
finally
{
if (connection != null)
{
connection.disconnect();
}
}
}
public static void main(String [] args)
{
DoPOST dp = new DoPOST();
}
}
___________________________________________________________________________
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