# Image upload component Error

**URL:** <https://forum.inductiveautomation.com/t/image-upload-component-error/64700>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 30, 2022, 12:11pm UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700 "2022-09-30T12:11:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepti\_k](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@deepti\_k](https://forum.inductiveautomation.com/u/deepti_k)\
**Post date:** [September 30, 2022, 12:11pm UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/1 "2022-09-30T12:11:17Z")

</div>

Hi ,I am trying to insert image details to the database using image upload component in perspective.Not able to pass image bytes to the method which call named query.Getting error as large file.So how i can achive this.I need to pass it as param.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 1, 2022, 1:04pm UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/2 "2022-10-01T13:04:43Z")

</div>

You are sending this image to a database? Can we see the specific error to help determine its origin?

---

<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:** [October 1, 2022, 2:05pm UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/3 "2022-10-01T14:05:36Z")

</div>

And share your non-working code.

---

<div class="post-metadata">

**Author:** ![deepti\_k](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@deepti\_k](https://forum.inductiveautomation.com/u/deepti_k)\
**Post date:** [October 2, 2022, 8:03am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/4 "2022-10-02T08:03:33Z")

</div>

This is the method which insert photo details  
`def insertphotodetails(fileStream,name):`  
`queryPath="gallery/insertdetails"`  
`queryParams={"fileStream":fileStream,"name":name}`  
`return system.db.runNamedQuery(queryPath,queryParams)`

Below is the code which calls above method.  
`fileStream = event.file.getBytes()`  
`name = event.file.name	`  
`insertPhoto = API.v1.Gallery.insertphotodetails.insertphotodetails(fileStream,name)`

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 2, 2022, 11:32am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/6 "2022-10-02T11:32:34Z")

</div>

You're image has cut off important information. Please copy and paste the error stack as preformatted text.

Looks like there is an issue coercing the byte list into another type of value. What is the type of the column that you are attempting to insert the bytes into?

---

<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:** [October 2, 2022, 4:28pm UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/7 "2022-10-02T16:28:13Z")

</div>

> [@lrose](#):
>
> What is the type of the column

The error is before that, when the parameter is coerced to the value parameter type before sending on to JDBC.

@deepti_k , show your named query definition (with parameter details).

---

<div class="post-metadata">

**Author:** ![deepti\_k](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@deepti\_k](https://forum.inductiveautomation.com/u/deepti_k)\
**Post date:** [October 3, 2022, 5:44am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/10 "2022-10-03T05:44:27Z")

</div>

```auto
Insert Into gallery ( filestream , name )values(:filestream,:name) 
filestream :ByteArray
name:string

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 3, 2022, 11:07am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/11 "2022-10-03T11:07:38Z")

</div>

You didn't show the parameter information, particularly the types of the parameters.

---

<div class="post-metadata">

**Author:** ![deepti\_k](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@deepti\_k](https://forum.inductiveautomation.com/u/deepti_k)\
**Post date:** [October 3, 2022, 11:19am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/12 "2022-10-03T11:19:59Z")

</div>

in query?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 3, 2022, 11:20am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/13 "2022-10-03T11:20:28Z")

</div>

Yes, how have you configured the parameters in the Named Query.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 3, 2022, 11:37am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/15 "2022-10-03T11:37:31Z")

</div>

I see that you have the named query set to use a parameterized database, but you are not providing a database parameter in you script.

Either, set the database connection as appropriate in the Named query, or if it is truly dynamic provide the database parameter.

```python
def insertphotodetails(fileStream,name):
    queryPath="gallery/insertdetails"
    queryParams={"database":"yourDatabaseConnectionName","fileStream":fileStream,"name":name}
    return system.db.runNamedQuery(queryPath,queryParams)

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 3, 2022, 11:52am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/17 "2022-10-03T11:52:59Z")

</div>

This is not the script that you showed in your earlier post.

---

<div class="post-metadata">

**Author:** ![deepti\_k](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@deepti\_k](https://forum.inductiveautomation.com/u/deepti_k)\
**Post date:** [October 4, 2022, 11:22am UTC](https://forum.inductiveautomation.com/t/image-upload-component-error/64700/19 "2022-10-04T11:22:24Z")

</div>

thanks it's working now.
