button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("main","보낸당2");
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 200);
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.e("main","온엑티2비티리절트옴2"+resultCode+","+requestCode);
if(resultCode==-1){
if(requestCode==200){
Uri selPhotoUri = data.getData();
Log.e("main","시~~작 ~~~~~!");
Cursor c = getContentResolver().query(Uri.parse(selPhotoUri.toString()), null,null,null,null);
c.moveToNext();
absolutePath = c.getString(c.getColumnIndex(MediaStore.MediaColumns.DATA));
DoFileUpload(urlString , absolutePath);
}
}
}
public void DoFileUpload(String apiUrl, String absolutePath) {
Log.e("main","타스크");
task1=new BackgroundTask2();
task1.execute();
}
class BackgroundTask2 extends AsyncTask {
protected void onPreExecute() {
source="Foto";
address = getString(R.string.url) + source;
}
@Override
protected Object doInBackground(Object[] params) {
try {
Log.d("Test", "mFileInputStream is "+absolutePath);
FileInputStream mFileInputStream = new FileInputStream(absolutePath);
URL connectUrl = new URL(address);
Log.d("Test", "mFileInputStream is " + mFileInputStream);
...............................이렇게 코드가 이어집니다. 그런데 doInBackground에서 absolutePath찍는데요,,,
D/Test: exception /storage/emulated/0/bichooser/IMG_0005.jpg: open failed: EACCES (Permission denied)
이게 계속 뜨네요...혹시나해서 매니페스트에서 external write, read둘다 퍼미션 해줬는데도 왜뜨는걸까요?
계속 진행이 안되네요...