Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2005
    Location
    EIB Network
    Posts
    474

    * DB structure suggestion

    I am developing a php/mysql database app for web visitors to submit their automobile profile. For instance, they will tell a little bit about their car in a form and select a file on their hard drive to upload for the picture of their car.

    My question is... where should the BLOB type variable go in my database scheme?? I have a table called "posts" which will include all the form elements submitted by the web visitors (ie, car description, miles on car, color, etc.).... is the "posts" table where I want to add the BLOB image???

    The reason I ask this is because there will be a lot of sorting and searching going on within the database and I was wondering if it was smart to have that large BLOB column amongst the other columns in the post table.... should the images have their own table??? Look forward to your suggestions.

  2. #2
    Here is an alternate idea: Dont store images in the DB at all.

    Just store the http path to the image file (relative or absolute)

    If you insist on having images stored, store them in a separate table with a link to the vehicle_id or whatever appropriate field.
    "The only difference between a poor person and a rich person is what they do in their spare time."
    "If youth is wasted on the young, then retirement is wasted on the old"

  3. #3
    Join Date
    Aug 2005
    Location
    EIB Network
    Posts
    474
    How do I save the uploaded images to a directory on my server? I know how to save them to the DB, unfortunately I do not know how to save to folder as file.

  4. #4
    There is a set of file-upload handling functions. You would probably want to put certain constraints on the data (filesize, extension, etc) and assign it a unique filename.

    Anyway, the php.net manual page on filesystem functions should be of help:

    http://us2.php.net/manual/en/ref.filesystem.php
    "The only difference between a poor person and a rich person is what they do in their spare time."
    "If youth is wasted on the young, then retirement is wasted on the old"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •