# Inserting Image to oracle DB 11g

**URL:** <https://forum.djangoproject.com/t/inserting-image-to-oracle-db-11g/15438>\
**Category:** Forms & APIs\
**Created:** [August 15, 2022, 10:53am UTC](https://forum.djangoproject.com/t/inserting-image-to-oracle-db-11g/15438 "2022-08-15T10:53:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdo2203](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/abdo2203/32/9716_2.png) [@abdo2203](https://forum.djangoproject.com/u/abdo2203)\
**Post date:** [August 15, 2022, 10:53am UTC](https://forum.djangoproject.com/t/inserting-image-to-oracle-db-11g/15438/1 "2022-08-15T10:53:06Z")

</div>

I want to insert images to oracle DB 11g, the table has a field Blob for images, i tried with insert with this code in views

\< Blockquote  
form = CarForm(request.POST)  
if form.is\_valid():  
pho\_matricule = form.cleaned\_data.get(“pho\_matricule”)  
pho\_date = form.cleaned\_data.get(“pho\_date”)  
pho\_employer= form.cleaned\_data.get(“pho\_employer”)  
pho\_photos = form.cleaned\_data.get(“pho\_photos”)  
conn = connection()  
cursor = conn.cursor()  
cursor.execute(“INSERT INTO GRHM.h\_photos VALUES (:pho\_matricule :pho\_date, :pho\_employer, :pho\_photos)”, [pho\_matricule, pho\_date,pho\_employer,pho\_photos])  
conn.commit()  
conn.close()

> Blockquote

But this wont work , could you please help

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 15, 2022, 11:47am UTC](https://forum.djangoproject.com/t/inserting-image-to-oracle-db-11g/15438/2 "2022-08-15T11:47:05Z")

</div>

First, when posting code here, enclose the block of code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.

If you want specific help, we’ll also need to see the Model and the Form for this.

You should probably also read:

- [Working with forms | Django documentation | Django](https://docs.djangoproject.com/en/4.1/topics/forms/)
- [File Uploads | Django documentation | Django](https://docs.djangoproject.com/en/4.1/topics/http/file-uploads/)
- [Uploaded Files and Upload Handlers | Django documentation | Django](https://docs.djangoproject.com/en/4.1/ref/files/uploads/#module-django.core.files.uploadedfile)

(Uploaded files are _not_ just additional fields in the form, they require special handling.)
