# Download files stored in database using ignition Perspective

**URL:** <https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 28, 2023, 11:13am UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699 "2023-03-28T11:13:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![KEERTHANA\_HEMANTH](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/keerthana_hemanth/32/42024_2.png) [@KEERTHANA\_HEMANTH](https://forum.inductiveautomation.com/u/KEERTHANA_HEMANTH)\
**Post date:** [March 28, 2023, 11:13am UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/1 "2023-03-28T11:13:41Z")

</div>

Hi,  
I have a table in my sql server database with filename, filedata and id.  
I need to give user the access to download the files stored in my database.  
Kindly help me resolve this issue

---

<div class="post-metadata">

**Author:** ![Ryan\_Allen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_allen/32/47013_2.png) [@Ryan\_Allen](https://forum.inductiveautomation.com/u/Ryan_Allen)\
**Post date:** [March 28, 2023, 11:24am UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/2 "2023-03-28T11:24:03Z")

</div>

Sounds like a great use of the reporting module

---

<div class="post-metadata">

**Author:** ![KEERTHANA\_HEMANTH](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/keerthana_hemanth/32/42024_2.png) [@KEERTHANA\_HEMANTH](https://forum.inductiveautomation.com/u/KEERTHANA_HEMANTH)\
**Post date:** [March 28, 2023, 11:26am UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/3 "2023-03-28T11:26:24Z")

</div>

How to proceed ahead

---

<div class="post-metadata">

**Author:** ![Ryan\_Allen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_allen/32/47013_2.png) [@Ryan\_Allen](https://forum.inductiveautomation.com/u/Ryan_Allen)\
**Post date:** [March 28, 2023, 11:27am UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/4 "2023-03-28T11:27:53Z")

</div>

Inductive University should have everything you need, here is a link to the reporting section:

[Inductive University Course List - Learn Ignition Free](https://inductiveuniversity.com/courses/ignition/reporting-in-ignition/8.1)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 28, 2023, 12:16pm UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/5 "2023-03-28T12:16:36Z")

</div>

> [@Ryan\_Allen](#):
>
> the reporting module

?

Why the reporting module?

You just need a query and `system.perspective.download()`.

---

<div class="post-metadata">

**Author:** ![Ryan\_Allen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_allen/32/47013_2.png) [@Ryan\_Allen](https://forum.inductiveautomation.com/u/Ryan_Allen)\
**Post date:** [March 28, 2023, 12:35pm UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/6 "2023-03-28T12:35:12Z")

</div>

I suppose I'm assuming the user that wants the data in a specific format

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 28, 2023, 12:46pm UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/7 "2023-03-28T12:46:11Z")

</div>

The OP specifies that his DB holds **filedata**. That implies it already is in a desired format.

---

<div class="post-metadata">

**Author:** ![Ryan\_Allen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_allen/32/47013_2.png) [@Ryan\_Allen](https://forum.inductiveautomation.com/u/Ryan_Allen)\
**Post date:** [March 28, 2023, 12:56pm UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/8 "2023-03-28T12:56:48Z")

</div>

Filedata implies it's in a nice format that an end user typically needs to see it? Learn something new every day!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 28, 2023, 1:00pm UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/9 "2023-03-28T13:00:21Z")

</div>

The combination of id, filename, and filedata (or similar names) is extremely common for storing blobs in databases. It implies that the row's blob is the entire file.

{ I tend to include an origin timestamp and a content type, but I'm a pedant. }

---

<div class="post-metadata">

**Author:** ![KEERTHANA\_HEMANTH](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/keerthana_hemanth/32/42024_2.png) [@KEERTHANA\_HEMANTH](https://forum.inductiveautomation.com/u/KEERTHANA_HEMANTH)\
**Post date:** [March 29, 2023, 1:33am UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/10 "2023-03-29T01:33:55Z")

</div>

Here I would like to give you a basic overview of wat I am trying to achieve

I have used file upload component to give user the facility to upload pdf.

The file name ,filedata (blob data) and id is getting stored in my database table once the user uploads

Now I want to give the user an ability to view and download the pdf which was uploaded

What is the feasible solution for this

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 29, 2023, 5:33pm UTC](https://forum.inductiveautomation.com/t/download-files-stored-in-database-using-ignition-perspective/71699/11 "2023-03-29T17:33:51Z")

</div>

The simplest solution is as described. Provide a download button that queries for the desired row, then supplies the blob data to `system.perspective.download()`.

To **view** the PDF, you'll want to place an IFrame component and use my [Blob Server](https://forum.inductiveautomation.com/t/automation-professionals-blob-server-module/57970) module (free) to deliver the content.
