Jump to content

Web Development - Database Question

I am beginning to get into web development and I am wondering about databases...Say I want to make a website, something with a nice login form in the beginning, then when I log in, it shows me say, my account folder, and I have certain files saved to it.  Then I can go on any computer, login with my credentials, and have access to my account's files...almost like a cloud service. I want to learn to make a very basic cloud service for testing purposes. I think its a good goal and a good way to learn about web dev.

 

My quetsion is how are these files stored, and where are they stored, if I make changes to it on one computer, obviousyly the changes are made to the database/server so if I login to my account on any computer, it will show the updated changes.

 

Does something like a MySQL database and fileserver take care of the saving files and account management? I am just trying to wrap my head around the workings of an online service.

Link to comment
https://linustechtips.com/topic/80601-web-development-database-question/
Share on other sites

Link to post
Share on other sites

id doubt any database system can manage files, however you can upload the files on a file sever and make a reference...

Grammar nazis are people too!
Treat your local grammar nazi nicely and he might teach you a thing or two. (Note that I'm Belgian and not a native English speaker.)
Chivalry isn't dead!

Link to post
Share on other sites

The ideal way to go about this is to save the files through the server's filesystem and to then have the physical location of the files in your database. You can also save the files directly "into" the database with MySQL but doing so generally decreases performance and also increases the complexity of your code.

Link to post
Share on other sites

Not really... Lots of sites store files in a mySQL table.

Set up the table to have a datatype of a blob or the equivalent.

Then in whatever server sided language your using read in the file, filter the input if needed, covert it to base10 or whatever you fancy. Then store that in the table. From there just covert the file back and set up DL links.

Getting directories set up will require some inheritance at either the database level or abstracted to the software level.

lots of tutorials online. The file structure will add some complexity to your code but, actually storing and getting the file is trivial.

On a side note, if this is just for you set up a dir with filetree permissions or whatever it is called and hide it behind an .htaccess restriction.

sorry if this is only somewhat helpful, responding from my phone in class so everything is off the top of my head.

Link to post
Share on other sites

Whether or not files are stored in the database as blobs or on the filesystem

with links to the paths and metadata in the database is an ongoing debate in the

web dev community.

There are upsides and drawbacks for both approaches, and both are used in practice.

Storing files on your filesystem and paths/metadata in your database has the advantage

that filesystems are actually made for, you know, storing files, and are therefore

optimized for that purpose and very good at it. Depending on the file system you use,

it will be able to optimize lots of things (deduplication, compression, encryption,

other stuff) which you will either not have if you store your files in a database,

or which you will have to implement yourself from scratch.

However, storing your files in a database also has some advantages, the primary one

being that you don't run the risk of getting discrepancies between your database and

your file system (for example: somebody could delete a file on the file system while

not deleting the corresponding entry in your database... messy; so you'd need to implement

measures to handle such a situation if you store files on the FS).

I have done a website where I store images in a database. It's nice if you can get it

to work, but it's definitely quite a bit of additional work to get it to function

properly IME.

And please don't create two topics for almost the same thing, you can roll your questions

all into one. ;)

To answer the first question from your other thread: Yes, MySQL is used for account management

in big projects. But do your research and do it right, account management (and therefore

user data) is not a trivial matter.

BUILD LOGS: HELIOS - Latest Update: 2015-SEP-06 ::: ZEUS - BOTW 2013-JUN-28 ::: APOLLO - Complete: 2014-MAY-10
OTHER STUFF: Cable Lacing Tutorial ::: What Is ZFS? ::: mincss Primer ::: LSI RAID Card Flashing Tutorial
FORUM INFO: Community Standards ::: The Moderating Team ::: 10TB+ Storage Showoff Topic

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×