Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2002
    Location
    York, United Kingdom
    Posts
    260

    Angry Image Uploads - Database or Standard Files

    Hello!

    Im needing to upload images for a website so that users will be able to have there own personal profile. I was wondering which is the best way to store these images, in a database (MySQL) or as a standard file in a directory. There is around 3,000 + Members on the site and im wanting to be able to let them upload more than 1 image! At the moment there is around 4,500+ images on the current site!



    Thanks in advance!

  2. #2
    Join Date
    Jan 2005
    Location
    Manchester, UK
    Posts
    194
    I've made something for each- for small amounts of files I'd say use mysql - but if you've got 3000 files which are gonna be accessed alot which will be like sending request.php?image=3026 for example, it will lagg.
    So for this many, I'd say have a file system.
    Maybe a sorting system, /0/ for the first 100, /1/ for the next 100 and so on.

    Just an idea - but personally for this traffic I'd prefer flat files.
    █ Software developer, web designer, and general clever-clogs.
    █ C#, XHTML, CSS, PHP, MySQL, MsSQL, T-SQL, Photoshop & more

  3. #3
    Join Date
    Mar 2004
    Location
    New Zealand
    Posts
    533

    Re: Image Uploads - Database or Standard Files

    Files. Just store the filename in your database, leave the file on the filesystem where it belongs.

  4. #4
    Join Date
    Oct 2002
    Location
    York, United Kingdom
    Posts
    260
    Thanks Guys!

    Im storing the images in a file system and then recording the name in a database in the same row as the customer details! Now i have to manually type in all 3000 + into the database

    I wish i could hire a temp guy!

  5. #5
    you can code a script to scan the directory and then insert into db.

  6. #6
    Join Date
    Dec 2002
    Location
    Jackson, MI
    Posts
    1,526
    yeah, helper scripts are your best friend

  7. #7
    Join Date
    Mar 2004
    Location
    USA
    Posts
    4,342
    this function will do:

    http://www.phptricks.com/?lesson_id=10&section=2

    Peace,
    Testing 1.. Testing 1..2.. Testing 1..2..3...

  8. #8
    Join Date
    May 2005
    Location
    Sydney Australia
    Posts
    81
    I've heard this question asked more than once and I think the best answer -- one that will apply more generally than just this specific instance -- is to consider the applicability of each storage mechanism for a given task.

    Filesystems have been design with the intent of performing that one specialized task very well and a database is much more of a general purpose tool. If something exists that is tailor made for that job, it is often going to be much better to use it and store any necessary references in a table, than to reproduce that functionality with a database.

Posting Permissions

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