0
如果文件名包含土耳其字符(ş,ı,ü,ü,ö,»),則該文件不會上傳到Web服務器。上傳到Web服務器是在PHP頁面上完成的。那裏沒有問題。它上傳不包含土耳其字符(英文字母)的文件名。我該如何解決這個問題?將文件上傳到Web服務器
private String uploadFile()
{
String responseString = null;
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(Config.FILE_UPLOAD_URL);
try
{
AndroidMultiPartEntity entity = new AndroidMultiPartEntity(new ProgressListener() {
@Override
public void transferred(long num) {
publishProgress((int) ((num/(float) totalSize) * 100));
} });
File kaynakDosya = new File(filePath);
entity.addPart("dosya", new FileBody(kaynakDosya));
entity.addPart("islem", new StringBody(GlobalVeri.IslemFotoVideoDosya));
totalSize = entity.getContentLength();
httppost.setEntity(entity);
HttpResponse response = httpclient.execute(httppost);
HttpEntity r_entity = response.getEntity();
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200) {
responseString = EntityUtils.toString(r_entity);
} else {
responseString = "Bir hata oluştu! Http Durum Kodu: " + statusCode;
}
}
catch (ClientProtocolException e) {
responseString = e.toString();
}
catch (IOException e) {
responseString = e.toString();
}
return responseString;
}
textview.getText()。的toString()? –
是我的源文件? –
entity.addPart(「dosya」,new StringBody(kaynakDosya.toString(),Charset.forName(HTTP.UTF_8))); //它沒有工作:( –