Displaying user uploaded documents i.e. PDF

Hi There,

Apologies if this question has already been answered somewhere on the forum.

I would like to display uploaded PDF documents for each user, how can I achieve this? I am saving the name of the PDF document on the database, however, the document gets saved in the folders directory.

Can somebody help with this, how can this be achieved so that the document uploaded for each user gets displayed dynamically on the page?

Thanks

Hi. You will need to access the PDF on page directly via a URL, and embed on page via iframe.
An example: https://www.w3docs.com/snippets/html/how-to-embed-pdf-in-html.html

If you can’t access the file directly due to security, you will need to create a secure file download SA, and use that URL in embed. File Downloads with Server Connect

1 Like

Just to chirp in… If you are starting to handle files, consider using S3. Files can quickly clog your web server up and S3 is an affordable and performant solution.

Plus - Wappler makes S3 super easy to use!

3 Likes

Yes. I need to start pitching S3 (or compatible) solutions in posts as well. Just like Git, S3 seems like a no-brainer as we continue to use it in more projects.

2 Likes

I do this with PDF files where the file is embedded to the right-hand side of a clickable list

<div dmx-show="!browser1.userAgent.contains('Mobile') && var_url.value" class="col-md-12 col-12 col-sm-12 col-lg-12 col-xl-6" style="height: calc(100% - 24px);">
	<embed type="application/pdf" width="100%" height="100%" dmx-bind:src="var_url.value + '#view=fitW,100'" />
</div>

4 Likes