hey,
can any one please help regarding accessing a posted file at the server.
my code goes like this:
CLIENT:
CODE
File input = new File("XMLFile1.xml");
RequestEntity entity = new FileRequestEntity(input);
PostMethod post = new PostMethod(url);
post.setRequestEntity(entity);
HttpClient httpclient = new HttpClient();
try
{
int result = httpclient.executeMethod(post);
if (result >=200 && result <=210 ) {
System.out.println("Request Timed out");
System.err.println("Method Failed:"post.getStatusLine()+ post.getStatusText());}
System.out.println("Response status code: "+result);
System.out.println(post.getResponseBodyAsString());
}
catch(Exception e)
{
System.out.println("Response body: ");
}
finally
{
post.releaseConnection();
}
SERVER:
CODE
Dim c, i As Integer
Dim objFile As HttpPostedFile
c = Request.Files.Count
For i = 0 To c - 1
objFile = Request.Files(0)
objFile.SaveAs("c:\test2\" + objFile.FileName)
Next
Response.Write©
the problem with this code is, i'm getting a response code as 200 when the file is posted.
but at the server, count variable c is showing 0(i.e Request.Files.Count=0).the file is not recieved by the server.
is this code correct? then why the count variable is showing 0? please help me this.
thank u in advance
*Always use code blocks
This post has been edited by PsychoCoder: 8 Oct, 2007 - 03:46 AM