Preview files(jpg,png,pdf)
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
Hello everyone.
I'm sorry, but I need your help.
I want to preview the files I uploaded to Firebase.
The uploaded files contain documents and images.
How can I solve this problem?
Thank you.
I'm sorry, but I need your help.
I want to preview the files I uploaded to Firebase.
The uploaded files contain documents and images.
How can I solve this problem?
Thank you.
12 Replies
@Masai Lion Hello everyone.
I'm sorry, but I need your help.
I want to preview the files I uploaded to Firebase.
The uploaded files contain documents and images.
How can I solve this problem?
Thank you.
you can create a local file link and then display an image using this local link:
const tempFileURL = URL.createObjectURL(currentFile);@B33fb0n3 you can create a local file link and then display an image using this local link:
tsx
const tempFileURL = URL.createObjectURL(currentFile);
Masai LionOP
Thank you for your help.
All files that need to be displayed are stored in Firebase.
When the page is loaded or new files uploaded, request is sent to backend to get the filelink, filename, and upload time of the files stored Firebase.
The data are mix of document files and image files, how can i display them as image?
All files that need to be displayed are stored in Firebase.
When the page is loaded or new files uploaded, request is sent to backend to get the filelink, filename, and upload time of the files stored Firebase.
The data are mix of document files and image files, how can i display them as image?
@B33fb0n3 you can create a local file link and then display an image using this local link:
tsx
const tempFileURL = URL.createObjectURL(currentFile);
Masai LionOP
When you upload a file to Skype, images and documents are previewed.
What I want is the same as this.
I want to display the file name and upload time together.
What I want is the same as this.
I want to display the file name and upload time together.
@Masai Lion When you upload a file to Skype, images and documents are previewed.
What I want is the same as this.
I want to display the file name and upload time together.
yes, as said, you can generate this tempFileUrl and then put it inside your image tag to display it:
You can do the same for your existing images from your firebase: Build the correct url to the firebase file and put it inside your "src" prop.
<Image src={tempFileURL} />You can do the same for your existing images from your firebase: Build the correct url to the firebase file and put it inside your "src" prop.
@B33fb0n3 yes, as said, you can generate this tempFileUrl and then put it inside your image tag to display it:
tsx
<Image src={tempFileURL} />
You can do the same for your existing images from your firebase: Build the correct url to the firebase file and put it inside your "src" prop.
Masai LionOP
Thank you.
how to preview pdf files?
how to preview pdf files?
Masai LionOP
sorry, could you explain in details?
@B33fb0n3
i used it but I didn't get the results I wanted.
@Masai Lion sorry, could you explain in details?
it really depends on the library that you are using. Normally you add it to your project and apply what the docs are saying. Then it will work fine
Masai LionOP
i will try again.
@Masai Lion tried?