Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:50:23+00:00 2026-06-11T21:50:23+00:00

i have an image filed in my model and i want to write SQL

  • 0

i have an image filed in my model and i want to write SQL create table queries myself
my model filed is this:

pic = models.ImageField(u"initial_picture",blank=True,upload_to="/face")

and i wanna use command CREATE TABLE SOME_TABLE_NAME to create my table
but i don’t know what should i use for the field type
i’v read here that i can use something like this:

Photo varbinary(max) not null

but i don’t know if it’s compatible for django and if it’s appropriate for my model
i also have used pic IMAGE DEFAULT NULL like what i saw here and the result was a varchar(100) field in the database structure

any help will be appriciated
😉

i’v tried both Photo varbinary(max) not null and Photo varchar(max) not null
the field is showing but when i press save, i get the following error:

Attempted access to '\face\sample.gif' denied.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:50:24+00:00Added an answer on June 11, 2026 at 9:50 pm

    Why don’t you keep the images in the file system, as plain files? This would be the corresponding SQL

    `pic` varchar(100) NOT NULL,
    

    for your pic field.

    pic = models.ImageField(u"initial_picture",blank=True,upload_to="/face")
    

    In the database, the pic field would only contain the path for the actual image file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this model: class MedicoImage(models.Model): medico = models.ForeignKey(Medico) imagem = models.ImageField(max_length=300,upload_to='img_medico') I want
I have a model containing ImageField which should be resized after uploading. class SomeModel(models.Model):
I have these models: class Gallery(models.Model): HeadImage = models.ImageField(upload_to=gallery,blank=True,null=True) class News(Gallery): Name=models.CharField(max_length=100) #some other
I have a model like this: class Item(models.Model): code = models.CharField(max_length=200, unique=True) barcode =
I have an image model and want to assign differnt, pre-choosen tags to the
I have a model ModelA with a field of type ImageField. Now, I want
I have a base model, and proxy models. I want to change value of
I have a Model with an image field and I want to be able
I have 3 models. class Picture(models.Model) name = models.CharField(max_length=255) image_field = models.ImageField(upload_to=foo/) slug =
In my model I have: has_attached_file :image, :storage => :s3, :styles => { :original

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.