react-admin-firebase icon indicating copy to clipboard operation
react-admin-firebase copied to clipboard

Uploading file to Firebase Storage replaces file filename with 'file' or index number

Open benfoley opened this issue 5 years ago • 1 comments

I was expecting that FileInput uploads would use the file names when saving them into the Firebase Storage bucket, but the file is renamed. Is there an option to keep the original filename?

My upload code is:

<FileInput source="file" label="File" accept="" multiple={true}>
  <FileField source="src" title="title" />
</FileInput>

Uploading two files results in this data in the Firestore record:

file:
0
src: "https://firebasestorage.googleapis.com/v0/b/BUCKET/o/entries%2Fentry%2Ffile%2F0?alt=media&token=TOKEN"
title: "test.pdf"
1
src: "https://firebasestorage.googleapis.com/v0/b/BUCKET/o/entries%2Fentry%2Ffile%2F1?alt=media&token=TOKEN"
title: "test-2.pdf"

And Storage ends up with two PDFs with files named 0 and 1. If multiple is false, then the file is renamed to file.

Can it be set to save the files with original names? Thanks

benfoley avatar Jun 25 '20 07:06 benfoley

Hey @benfoley, Thanks for contributing, that's a great idea. I'll merge in your PR and add it as an option to the configuration options. Cheers, Ben

benwinding avatar Jul 21 '20 08:07 benwinding