0
파일을 http 서버에 업로드하고 싶습니다. 이것은 내가 지금까지 가지고있는 코드이다. 문제는 파일이 전혀 업로드되지 않는다는 것입니다. 코드에 무슨 문제가 있습니까?파일을 HttpConnection에 업로드 - BLACKBERRY/JavaME
업데이트 : 문제를 해결할 수있었습니다. 같은 문제가있는 사람이라면이 코드가 도움이 될 수 있습니다.
try{
FileConnection path = (FileConnection)Connector.open(main_directory + "status.zip");
if (!path.exists()) {path.create();}
byte[] buf ;
buf = new byte[(int) path.fileSize()];
in = path.openInputStream();
in.read(buf);
Logger.logEventInfo("FILE INPUT: " + in);
ByteArrayOutputStream outputstream = new ByteArrayOutputStream(buf.length);
Base64OutputStream base64 = new Base64OutputStream(outputstream);
base64.write(buf);
String upload = null; upload = outputstream.toString();
while ((길이 = in.read (buf))> = 0) { bout.write (buf, 0, length); } – JohnDoe4136
코드가 혼란 스럽습니다. 제거되거나 단순화 될 수있는 많은 것들이있을 수 있습니다. 그러나 적어도 줄'String FileUpload = new String (byout.toByteArray(), "UTF8");)은보기에 좋지 않습니다. – BalusC
서버에 업로드 할 수 있도록 파일을 열고 String에 쓰려고합니다. – JohnDoe4136