0
我嘗試從php服務器發送文件到Andorid客戶端。這是我的Java代碼:將文件從php服務器發送到Android客戶端
InputStream in = null;
try {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(new HttpGet(URL));
in = response.getEntity().getContent();
}
catch (Exception e) {
Log.e("[GET REQUEST]", "Network exception");
}
String fileName = "form.xml";
File destinationfile = new File(Environment.getExternalStorageDirectory() + "/ServiceHelper/" + fileName);
BufferedOutputStream buffer = new BufferedOutputStream(new FileOutputStream(destinationfile));
byte byt[] = new byte[1024];
int i;
for (long l = 0L; (i = in.read(byt)) != -1; l += i) {
buffer.write(byt, 0, i);
}
我不知道應該怎麼看起來像在PHP服務器的一部分,發送和保存文件,例如,德克薩斯州,或XML。
我將您的任何建議