Question:
I don't get the idea of how file storage in mySQL works help me?
2009-05-28 04:41:58 UTC
well i'm new in this kind of thing and got my mind and interest. I'm building a small project in school namely a website with file storage, this will deal with a database obviously, but isn't it that a a database like mySQL stores only information with in tables? I learned how to upload a file using php, and that will upload and store the file in the server's hard drive. now i'm thinking will this be possible to be organized in the table? is it possible to store a file's name, filename, size, etc in a table? how about when i put in a browse function in my site, and when i browse into a certain file will it display the information of that file? can i organize that using php? and is it possible to change a file name and tags using php?

sorry for the confusion i have a curious mind and i would like to hear it straight from you guys. please correct me if i'm wrong in the question i'm kinda starting out in this php mysql stuff and some tutorials are quite incomplete.
highest points for the best answer
Five answers:
2009-05-28 04:59:30 UTC
The database tables store the file's location information, that's all. You will design the database and the tables, so you will determine what information is stored in it. You will write the queries necessary to add, deleted, modify and extract that information as part of your PHP scripts.



While you can technically store the actual *file* in a database, that's not what you're doing, and most databases don't get used that way.



You upload the file to the server. The database tables gets updated with the name and location of the file (on the server) and the other data (size, date, etc) if you like.



You can then build a list of the file names on the site, and when a visitor clicks one, you query the database for the file's information, which you can then display on the page.



The actual file storage itself has nothing to do with the database, other than to point to it's location (if the table is set up that way). Remember, YOU will decide what information goes in the database table.



Think of this analogy. Your website is like a book with information. The files are the information resource. The site is a reference to them, and the database tables are like the table of contents or the index of files. When a file is chosen by the user, they are taken to a "page" in your "book" that gives them additional information about the file.



PHP will enable you to do a lot of things. In fact, when you use PHP to upload a file, it actually does rename it to a temporary name until you instruct it (in your script) you save or delete the file. You can save it with the original name, or rename it. You can rename it or move it after the fact. PHP is very flexible, not just for web site programming, but for general file work.
vhinz
2009-05-28 05:38:42 UTC
Q: Isn't that a a database like mySQL stores only information with in tables?

A: Yes, you can store a files information on the database tables like, file size, file type, etc. etc.



Q: Will this be possible to be organized in the table?

A: Yes, With php, you can organize files, rename files etc etc.



Q: Is it possible to store a file's name, filename, size, etc in a table?

A: Yes. Its the main purpose of a database. Store data ^_^



Q: How about when i put in a browse function in my site, and when i browse into a certain file will it display the information of that file?

A: Yes, you can do that with PHP. You can display information of files that has been uploaded. As long as you saved that files information.



Q: Can i organize that using php?

A: Yes, PHP has a lot of functions regarding "file manipulation thingy"



Q: Is it possible to change a file name and tags using php?

A: Change a file name? Yes. Tags? hmm, what tags. You can change the name of a file.., but tags, if you're saying about TEXT values with html tags, yes you can.



You should practice more on saving data on a database. If you have appServ installed locally in your pc, you can experiment and also research more about php file functions. Check out my links, it might help. :)



vhinz -> Web developer
2009-05-28 04:48:36 UTC
I wouldnt recommend storing your files on the database, that can build up real quick and its not fun working on databases that are gigs big. You do have better security though storing your files on the database but it will take more time to implement than just the regular upload to the server. Let me know if you have any other questions.
2016-10-26 15:04:04 UTC
once you're utilizing InnoDB as a storage engine: swap to MyISAM and anticipate MySQL 6 which will contain an finished alternative for InnoDB. no matter if you do not use InnoDB, disable it besides. On some machines InnoDB is in basic terms troublemaker.
Pramod Kumar
2009-05-28 04:49:32 UTC
Below will help you



http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/uploading-files-to-mysql-database.aspx


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...