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

  • Home
  • SEARCH
  • 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 9148281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:13:53+00:00 2026-06-17T11:13:53+00:00

Possible Duplicate: When to store images in a database(mySQL) and when not? (Linking image

  • 0

Possible Duplicate:
When to store images in a database(mySQL) and when not? (Linking image to item in database)
Which is the best method to store files on the server (in database or storing the location alone)?

What should I consider to best choose between storing MP3s/pdfs with a database.
Is it better to store the file as a BLOB in the DB? or is it better to just have a field that allows me to look at the filesystem?

The files in questions are not likely to exceed 15MiB, but all likely to be at least 1MiB, in case that’s a consideration.

The data will be accessed via PHP, if that makes a difference…

Edit: I’ll go with what I was already doing 🙂 resources on the filesystem with filenames in the database. Thanks or the input!

  • 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-17T11:13:54+00:00Added an answer on June 17, 2026 at 11:13 am

    I’ve been working on a project for the last 3 years where large attachments were stored in the database.

    Advantages

    • Managing records in a database is easier and less code than having to handle associated files.
    • Even with CakePHP’s behaviors to automate the task. The database is easier.
    • Some projects have security requirements to keep data in the database (even if it doesn’t really improve security).
    • Automated build processes can easily backup the data, because it’s already in the database anyway.

    Disadvantages

    • Taking snapshots of the database for development is a pain.
    • After you pass several GBs in size. No matter what people tell you. You’ll start to sweat wondering if the DB engine can handle it.
    • Dumping the database starts to take very long.
    • Data migration to a different schema starts to require non-SQL solutions.

    Myths About DB Blobs

    • That your database can’t handle a large database file size.
    • That one bad sector on the hard drive means you could lose all your blob data.
    • That there is a performance cost to storing in the database.
    • That it’s more secure.
    • That reading from the DB and sending to the client is slower than reading a file and sending it.

    All the above (from my experience) is false.

    Facts About Large Blobs

    • There will come a time when you no longer want it in the database.
    • GUID record identifiers are your friend. Don’t use the record (int)ID in the file name.
    • You don’t need to reverse find a record from a file name, but you need to find a file from a record. So you can just use the guid as the file name.
    • It’s easier to backup/copy a file system and a small database, then just a large database.
    • Don’t store the files in your webroot.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Best way to store password in database I have a database (mySQL)
Possible Duplicate: What's the best way to display an image from a sql server
Possible Duplicate: how to store image in sqlite database this is my code for
Possible Duplicate: Why entered key word is not store in database? I'm writing a
Possible Duplicate: store multiple checkbox values to database using php and mysql How to
Possible Duplicate: base64 encoded images in email signatures I have a image stored in
Possible Duplicate: Storing Images in DB - Yea or Nay? Images in database vs
Possible Duplicate: How to store an array into mysql? This is an array that
Possible Duplicate: Storing Images in DB - Yea or Nay? I need to store
Possible Duplicate: How to capture an image and store it with the native Android

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.