title: How to get path of selected image
body: <p>Currently i am taking image from <code>camera and gallery</code> . When i take picture from camera then the path is <code>storage/sdcard0/pictures/androidfileupload/</code>.</p>
  
  <pre><code> private static File getOutputMediaFile(int type) {
  
      // External sdcard location
      File mediaStorageDir = new File(
              Environment
                      .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
              "Android File Upload");
  
      // Create the storage directory if it does not exist
      if (!mediaStorageDir.exists()) {
          if (!mediaStorageDir.mkdirs()) {
  
              return null;
          }
      }
  
      // Create a media file name
      String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss",
              Locale.getDefault()).format(new Date());
      File mediaFile;
      if (type == MEDIA_TYPE_IMAGE) {
          mediaFile = new File(mediaStorageDir.getPath() + File.separator
                  + "IMG_" + timeStamp + ".jpg");
      }  else {
          return null;
      }
  
      return mediaFile;
  }
  </code></pre>
  
  <p>so from the above code i am fetching <code>storage/sdcard0/pictures/android file upload/</code> . </p>
  
  <p>Now i am taking selected image from gallery so it shows error like <code>storage/sdcard0/pictures/androidfileupload/imagename.jpg</code> is not found .</p>
  
  <p>I have debug the code and i get the path of selected image from gallery <code>content://media/external/images/media/26435</code> but i want the path like 
  <code>content://media/external/images/media/imagename.jpg</code>.</p>
  
  <p>so how can i get the path with <code>imagename.jpg</code>.?</p>