> file is beeing sent (but it seems it does not gets there), and after that I receive the respopnce code = 200
issue is perhaps more on the server side.
Main Topics
Browse All TopicsHi everyone, I am strgling with this problem for two weeks now. And don't have an idea what's wrong with my code.
Here is the code which SHOULD send the file using POST method to "http://www.comefly.org/ci
try {
File f = new File("D:\\Programming\\Jav
PostMethod filePost = new PostMethod("http://www.com
filePost.setParameter("Use
StringPart sp = new StringPart("uploadfile", "D:\\Programming\\Java\\Cl
String fname = f.getName();
FilePart fp = new FilePart(fname, f);
Part[] parts = { sp, fp };
filePost.setRequestEntity(
HttpClientParams pars = new HttpClientParams();
pars.makeLenient();
pars.setParameter(pars.USE
HttpClient client = new HttpClient(pars);
int status = client.executeMethod(fileP
System.out.println("Status
byte[] responseBody = filePost.getResponseBody()
System.out.println(new String(responseBody));
} catch(IOException ioe) {
ioe.printStackTrace();
}
In other words, can somebody look through the code, and say what am I missing here, what did I do wrong, cause when sending the file through browser it is accepted, but when using my java app the connection is established, file is beeing sent (but it seems it does not gets there), and after that I receive the respopnce code = 200, that everything went OK. I am loosing my temper on this already. It looks it should work, but it doesn't.
I'd like You to run my code (supplying valid file), and check if You can succeed. I have one thought in my mind. Maybe different Java versions are crossing each others ways, cause I have all major versions installed on my winxp (1.0, 1.1.8, 1.2.2_017, 1.3.1_17, 1.4.2_10, 1.5.0_06 and 1.6.0-rc-b63).
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
CEHJ,
thanks, my results are totally the same, I'll try to check if the 'test.txt' was delivered, the server is down already.
objects,
what issues could there be, I don't see any difference in using httpclient and some browser, but the results differ.
see You tomorrow, I'll try to get some more info to this question.
Business Accounts
Answer for Membership
by: CEHJPosted on 2006-01-27 at 12:29:14ID: 15808569
This is my output:
========== ========== ========== ========== ======
xglc1hVB8a qZLnCZFujz nmg <br />
mp
//========================
Status: 200
<PRE>
Neatsiustas :(!Host: www.comefly.org <br />
Connection: keep-alive <br />
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 <br />
Content-Length: 470 <br />
Content-Type: multipart/form-data; boundary=N7IzaSZHGkbQhA0NS
X-Forwarded-For: 217.134.125.240 <br />
Via: 1.1 webcacheH10 (NetCache NetApp/5.5R3D3) <br />
failai:
Array
(
[test_txt] => Array
(
[name] => test.txt
[type] => application/octet-stream
[tmp_name] => D:\php\xampp\tmp\php3280.t
[error] => 0
[size] => 24
)
)
kintamieji:
Array
(
[uploadfile] => C:/test.txt
)
</PRE>