title: why are my firebase storage files 0 bytes?
body: <p><a href="https://i.stack.imgur.com/r2KdE.png" rel="nofollow noreferrer">Google Firebase Storage Image (for Reference)</a>
  I am trying to save photos taken from a camera intent and save them to Firebase Storage. Because I am targeting Android API 25, I must use a Fileprovider to create the URI for the image. 
  I am able to successfully open the camera, take a photo, and upload the photo to my Firebase Storage bucket. The file is uploaded to Firebase and it is named correctly (as specified in my code). However, I receive the error "Error Loading Preview" and the file size is 0 bytes. When I download the file on my computer (a jpeg) the windows gallery says "We can't open this file"</p>
  
  <p>Has anyone else run into this problem?</p>
  
  <pre><code>public class AddPhotoActivity extends AppCompatActivity {
  private static final int REQUEST_GALLERY_PICKER = 321;
  private static final int CAMERA_REQUEST = 123;
  
  private String mCurrentPhotoPath;
  private StorageReference mStorage;
  
  private File createImageFile() throws IOException {
      String timeStamp = new SimpleDateFormat("yyyMMdd_HHmmss").format(new Date());
      String imageFileName = "JPEG_" + timeStamp + "_";
      File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
      File image = File.createTempFile(
              imageFileName,
              ".jpg",
              storageDir
      );
      mCurrentPhotoPath = image.getAbsolutePath();
      return image;
  }
  
  private void dispatchTakePictureIntent() {
      mStorage = FirebaseStorage.getInstance().getReference();
  
      Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      takePictureIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
      if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
          // Create the File where the photo should go
          File photoFile = null;
          try {
              photoFile = createImageFile();
          } catch (IOException ex) {
              Toast.makeText(getApplicationContext(), "Error creating file", Toast.LENGTH_SHORT).show();
          }
          Uri photoUri = FileProvider.getUriForFile(this, "co.mymemento.mementocaregiver.fileprovider", photoFile);
          takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
          startActivityForResult(takePictureIntent, CAMERA_REQUEST);
  
          StorageReference filepath = mStorage.child("memento_images").child(photoUri.getLastPathSegment());
          filepath.putFile(photoUri).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
              @Override
              public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
  
              }
          }).addOnFailureListener(new OnFailureListener() {
              @Override
              public void onFailure(@NonNull Exception e) {
  
              }
          });
      }
  }
  </code></pre>