WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4402 closed enhancement (wontfix)

Store uploads in database, not filesystem

Reported by: msrivathsan Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2
Component: Administration Keywords:
Focuses: Cc:

Description

Currently, File uploads are stored in a dir. under the WordPress webdir and other data in the DB. The following are the problems in this approach:

  1. The File upload dir and the DB could easily go out of sync
  2. It is a big pain for the Site Admin in performing backups and restores

Having such file uploads outside DB (in my opinion) is an outdated funda. Nowadays, DBs can hold very large data and also can effectively manage them, unlike 10 years back.

So this feature would be a great boon to SiteAdmins.
-end-

Change History (9)

comment:1 rob1n7 years ago

  • Milestone changed from 2.4 to 2.3
  • Summary changed from Need to have "all" WordPress data in the DB to Store uploads in database, not filesystem

I like this idea, if only for uploads.

comment:2 follow-up: Otto427 years ago

Make it optional. Really, really optional. I would even default it to not do this behavior.

Because having file downloads come out of the database could bring down a site really quick for larger/more popular downloads. If I'm posting a file more than, say, a hundred KB, I would not want it in the DB for simple speed reasons.

Also, web hosts everywhere will hate you if you enable this sort of thing. Their mySQL databases are already oversold/overloaded, and this will only make that problem a lot worse.

-1.

comment:3 markjaquith7 years ago

We should continue to "hook" the crap out of the file upload system. You should be able to enable alternative storage mechanisms via plugin.

comment:4 in reply to: ↑ 2 intoxination7 years ago

Replying to Otto42:

Make it optional. Really, really optional. I would even default it to not do this behavior.

Because having file downloads come out of the database could bring down a site really quick for larger/more popular downloads. If I'm posting a file more than, say, a hundred KB, I would not want it in the DB for simple speed reasons.

Also, web hosts everywhere will hate you if you enable this sort of thing. Their mySQL databases are already oversold/overloaded, and this will only make that problem a lot worse.

-1.

On top of the fact that numerous shared hosts use external database servers that are already running at maximum load. This would have a great chance of over-taxing those servers (that are already about over taxed).

I agree with Mark - this is best for a plugin

comment:5 follow-up: zamoose7 years ago

Another -1 from me. What if I want to link to an image from, say, a Tumblr blog, Twitter, etc. and don't have access to $wpdb?

Uploads should stay in statically-managed areas and served by webservers that excel at serving just that -- static content.

Anything else seems a bit silly and wrong-headed, particularly for shared hosting environments.

comment:6 hgurol7 years ago

Im not completely opposed to but as a reminder; db storage is more expensive then the file system storege. And managing/maintaning a db system is harder then the file system. The difference would be more evident as the size of the data grows to be BIG.

I say making it optional is a must, making it with a plugin is even better.

Anyway, just my 2c$...

comment:7 in reply to: ↑ 5 rob1n7 years ago

  • Milestone 2.3 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to zamoose:

Another -1 from me. What if I want to link to an image from, say, a Tumblr blog, Twitter, etc. and don't have access to $wpdb?

Um, well, it would be from the DB and into a static URL, done so with mod_rewrite.

Uploads should stay in statically-managed areas and served by webservers that excel at serving just that -- static content.

True, but for simple images this might be easier.

Makes good sense for a plugin.

comment:8 ryan7 years ago

If someone wants to do the work to abstract WP's file ops so that we can plug in mogilefs, s3, a DB backend, or what-have-you, that would be accepted in WP core. The default backend would be the regular fs. Think of how we do the object cache.

comment:9 Otto427 years ago

There are hooks all over the upload functions.

If you want to write a plugin to change how uploads work, then there's a filter hook on 'wp_handle_upload' that you'll find useful, along with the 'edit_attachment' and 'add_attachment' action hooks. You'll also need the 'wp_update_attachment_metadata' filter.

And if even that's not enough, there's a hook to replace the entire file upload system with whatever you like. Just add a filter to 'uploading_iframe_src' and you can write your own frame to fill that space, and manage your uploads any way you want.

Note: See TracTickets for help on using tickets.