php code which upload the httpclient post file in java
hi
here is the java client function which post a file for upload to server
public void postAFile(String url, String filefrom){
//url="http://192.168.100.40/php_prgs/var/www/nsboxng/htdocs/tryupdate.php?filename=test.xml";
//filefrom=/home/raghavendra/Documents/test.xml;
HttpClient client = new HttpClient();
PostMethod postMethod = new PostMethod(url);
client.setConnectionTimeout(8000);
// Send any XML file as the body of the POST request
File f = new File(filefrom);
System.out.println("File Length = " + f.length());
try{
postMethod.setRequestBody(new FileInputStream(f));
postMethod.setRequestHeader("Content-type",
"text/xml; charset=ISO-8859-1");
int statusCode1 = client.executeMethod(postMethod);
System.out.println("statusLine>>>" + postMethod.getStatusLine());
// gets the response from the server
BufferedReader console = new BufferedReader(new InputStreamReader(postMethod.getResponseBodyAsStream()));
String line = null;
try {
while ((line = console.readLine()) != null) {
System.out.println("output"+line);
}
}
catch (IOException e) { }
postMethod.releaseConnection();
}
catch(IOException e){
}
}
i want to upload posted file to server using php code
can anybody please help me php code which receive this file and uploads
please help me.

