title: Error reading file: java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
body: <p>I need to pick a image from my gallery and put on my baasbox server.
  To do this,I need a InputStream of my image.</p>
  
  <p>BaasBox Docs report this:</p>
  
  <pre><code> InputStream data = ...; // input stream to upload
   BaasFile file = new BaasFile();
   file.upload(data, new BaasHandler&lt;BaasFile&gt;() {
              @Override
              public void handle(BaasResult&lt;BaasFile&gt; baasResult) {
                  if( baasResult.isSuccess() ) {
                      Log.d("LOG","File uploaded with permissions");
                  } else {
                      Log.e("LOG","Deal with error",baasResult.error());
                  }
              }
          });
  </code></pre>
  
  <p>So,I searched in internet how can do this.</p>
  
  <h2>My MainActivity is this:</h2>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements View.OnClickListener {
  
  private int PICK_IMAGE_REQUEST = 1;
  
  private Button buttonChoose;
  private Button buttonUpload;
  private Button buttonView;
  private ImageView imageView;
  
  private Bitmap bitmap;
  
  private Uri filePath;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      buttonChoose = (Button) findViewById(R.id.buttonChoose);
      buttonUpload = (Button) findViewById(R.id.buttonUpload);
      buttonView = (Button) findViewById(R.id.buttonViewImage);
  
      imageView = (ImageView) findViewById(R.id.imageView);
  
      buttonChoose.setOnClickListener(this);
      buttonUpload.setOnClickListener(this);
  
      //omitted information about baasbox init and login with a admin user
  
  
  private void showFileChooser() { //dal tutorial
      Intent intent = new Intent();
      intent.setType("image/*");
      intent.setAction(Intent.ACTION_GET_CONTENT);
      startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
  }
  
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == PICK_IMAGE_REQUEST &amp;&amp; resultCode == RESULT_OK &amp;&amp; data != null &amp;&amp; data.getData() != null) {
  
          filePath = data.getData();
          Log.d("log","Uri is: " + filePath.toString());
          try {
              bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
              imageView.setImageBitmap(bitmap);
              Log.d("log","upload started!");
              uploadToBB(filePath);
  
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  
  public void uploadToBB(Uri filePath){
      FileInputStream in;
      BufferedInputStream buf;
      try {
          in = new FileInputStream(filePath.toString());
          buf = new BufferedInputStream(in);
          Bitmap bMap = BitmapFactory.decodeStream(buf);
          InputStream data = getContentResolver().openInputStream(filePath);// input stream to upload
          BaasFile file = new BaasFile();
          file.upload(data, new BaasHandler&lt;BaasFile&gt;() {
              @Override
              public void handle(BaasResult&lt;BaasFile&gt; baasResult) {
                  if( baasResult.isSuccess() ) {
                      Log.d("LOG","File uploaded with permissions");
                  } else {
                      Log.e("LOG","Deal with error",baasResult.error());
                  }
              }
          });
  
          if (in != null) {
              in.close();
          }
          if (buf != null) {
              buf.close();
          }
      } catch (Exception e) {
          Log.e("Error reading file", e.toString());
      }
  }
  </code></pre>
  
  <p>So,when it started,I choose a picture from gallery and uploadToBB() start.. but it return me this error code at RunTime (the app not crash):</p>
  
  <p>D/log: Uri is:content://com.android.providers.media.documents/document/image%3A30947</p>
  
  <p>D/log: upload started!</p>
  
  <p>E/Error reading file: java.io.FileNotFoundException: content:/com.android.providers.media.documents/document/image%3A30947: open failed: ENOENT (No such file or directory)</p>
  
  <p>Is necessary put a InputStream in a baasBox upload() method.
  Can you help me?
  Thanks!</p>