从android的内部存储器保存和上传文件
我曾尝试将文件保存到内部存储器中
String smsXml = "<messages><sms><From>" + address + "</From><Date>" + finalDateString + "</Date><Body>" + msg +"</Body></sms></messages>";
try {
//saving the file as a xml
FileOutputStream fOut = openFileOutput("textMessage.xml",MODE_WORLD_READABLE);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(smsXml);
osw.flush();
osw.close();
}
catch (Throwable e) {
Log.d("Exception","Exception:"+ e);
}
现在我尝试将文件上传到服务器但是我怎样才能获得文件路径来上传这个。我已经成功地从 sd 卡上传了一个 .mp3 但是如何从内部存储器中做到这一点。按照此链接上传 .mp3
final String uploadFilePath = "android/data/data/com.example.sms/files/";
final String uploadFileName = "textMessage.xml";