Results 1 to 2 of 2

Thread: Database Design For Organizing User Submitted Files

  1. #1
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default Database Design For Organizing User Submitted Files

    I need some advice / ideas for setting up tables to keep track of user submitted files.

    MySQL database.

    Each user has a unique user_id. They must be logged in to upload a file.

    Users can upload photos, videos, and text files.

    The files they upload must have a relation to each other well. For example, a user uploads 4 photos, a video, and a text file based on a common theme. This "group" of files is different than when the same users uploads another set of files based on a different theme.

    I am thinking about three different tables, one for each type of file. Four columns in each table. One is a primary key, one the user_id, one the name of the file, and one the path to the directory that holds the file.

    Maybe the date of upload as well?

    But I can't figure out how to relate them all to each other, especially if the user uploads files from the same "group" at different times.

    I am going to use PHP to write the scripts that handle all this.

    Thanks a lot! I appreciate the help.

    JasonDFR

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Personally, I like to use as few tables as possible. I would create a table with

    Code:
    create table tablename( 
    (ID int not null auto_increment,
    date datetime,
    user_name text,
    key_words text,
    photos text,
    videos text,
    primary key(ID))
    ...figured it would be easier to just show you.

    I would store the photos and videos in two folders on your site and store the locations to the photos and videos in your database. The users would be able to upload files on different days/times. The info could be retrieved from the database with something like

    Code:
    select * from tablename where user_name =bob and key_words LIKE '%term%'
    of course there are many ways of doing what you want and this is just one method.

Bookmarks

Posting Permissions

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