# Upload pictures to server, call pictures within perspective

**URL:** <https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434>\
**Category:** Maker\
**Tags:** perspective\
**Created:** [August 9, 2024, 5:31pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434 "2024-08-09T17:31:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Earl\_Jensen2](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Earl\_Jensen2](https://forum.inductiveautomation.com/u/Earl_Jensen2)\
**Post date:** [August 9, 2024, 5:31pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434/1 "2024-08-09T17:31:31Z")

</div>

I am doing a for-fun project and looking to do something similar to how selecting a user profile picture for a user would be.

Here's what I am imagining to do, I'm just not sure how to do this and/or if this is the right way to do this. This is a private application so I don't need any crazy security or things for failsafe/issues, and it can be ugly. This will run in perspective:

1. User interface to upload picture. Picture stored on gateway server.
2. Go to web page with details of user info. Data set is stored in db and is pulled when you go into that user's page.  
FOR LOADING IN PICTURES ON THIS PAGE:
3. db column 'imagePath' contains directory on server to the image. When data set loaded in, there's some way to grab that path and load in image from that path.  
FOR SAVING/SELECTING PICTURES:
4. whatever is easiest for this. If there's a input field where you just type the image name and that updates the db which then updates image that's shown. Or maybe a windows explorer popup and you select the image in a directory.

Any help on this is appreciated!!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 9, 2024, 5:33pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434/2 "2024-08-09T17:33:43Z")

</div>

If you're already using a DB...why not just store the images in the DB? Use a BLOB column, or whatever your DB calls it, and you're done. Profile pictures aren't going to be very large.

---

<div class="post-metadata">

**Author:** ![Earl\_Jensen2](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Earl\_Jensen2](https://forum.inductiveautomation.com/u/Earl_Jensen2)\
**Post date:** [August 9, 2024, 5:34pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434/3 "2024-08-09T17:34:45Z")

</div>

OK I'll look into BLOBs on SQL side, I have never used them.

How can I display it on ignition perspective side does it just come through and display it or something else\*?

edit: Uploading pics into the db too so I still need interface for user to convert image to blob

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [August 9, 2024, 5:36pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434/4 "2024-08-09T17:36:23Z")

</div>

Check out Phil's module.

> [@Automation Professionals' Blob Server Module](https://forum.inductiveautomation.com/t/automation-professionals-blob-server-module/57970):
>
> Automation Professionals is pleased to announce an alpha release of its new Blob Server Module. Available only for Ignition v8.1, here. The Blob Server Module provides a simple way to deliver images, PDF files, or other binary content from a database to your Perspective clients or other web applications. Without needing the WebDev module. All you need is a Named Query that has appropriate security settings and returns a single row with two columns: Content, and ContentType. Modest documentati…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 9, 2024, 5:42pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434/5 "2024-08-09T17:42:03Z")

</div>

> [@Earl\_Jensen2](#):
>
> I still need interface for user to convert image to blob

No, you literally take the binary bytes of the image out of the file upload component and shove it directly into the database. No conversion needed.

You can also use data URIs (free, but some performance limitations), or Ignition's first-party WebDev module (at cost) to serve the files out of the database. Phil's module is free though, so as long as you're not running on Ignition Edge it's a fine option.

---

<div class="post-metadata">

**Author:** ![Earl\_Jensen2](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Earl\_Jensen2](https://forum.inductiveautomation.com/u/Earl_Jensen2)\
**Post date:** [August 9, 2024, 11:08pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434/6 "2024-08-09T23:08:18Z")

</div>

edit: Ahh above mentions **File Upload component** I'll look into that..probably what I need!

Phil's worked great for what I need!

I'm still unsure the best way to get images _into_ the db, did I miss something in Phil's or is there a good way in Perspective to do upload an image and push into db blob column?

Right now I can force them in with something similar to below (mssql):

```python
INSERT INTO Images (ImageName, ImageData)
SELECT 'example.jpg', 
       BulkColumn 
FROM OPENROWSET(BULK 'C:\Path\To\Your\Image\example.jpg', SINGLE_BLOB) AS ImageFile;

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 9, 2024, 11:12pm UTC](https://forum.inductiveautomation.com/t/upload-pictures-to-server-call-pictures-within-perspective/94434/7 "2024-08-09T23:12:35Z")

</div>

To upload a file in Perspective, you **must** use the file upload component:

> **[Download and Upload Files | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-input-palette/perspective-file-upload/download-and-upload-files#uploading-a-file)**
>
> Downloading and uploading files from a Perspective session typically involves storing and retrieving files from a database. A table will store all of the available files, and each row of the table represents a new file. This allows for long term...

Your code won't work in real usage. Perspective scripts are actually running wherever the Ignition **Gateway** is, so the `C:\` reference you're giving is relative to the _Gateway's_ filesystem. And in actual user sessions on different browsers/mobile devices/etc, browsers are not allowed access to the local filesystem at all, because of malware. The File Upload component (which only works when the user directly interacts with it, and opens a browser-provided file picker) is the _only_ way to upload files in Perspective.
