Can I upload files and store them in my database?

Asked by:
almafly / 5 Points
Time:
2011-11-05 8:16 pm EST
Category:
Databases
Hits:
1,977
I created a small search engine for my site using php its connected to a data base. I also have a upload section on my site where people upload documents is there a way i can have the uploaded files go directly into my search engine database?

To ask this user for more information, please first login.

To submit an answer, please login.

Best answer chosen by Web Hosting Hub staff

1

ChristiNi
Staff
13,688 Points
2011-11-07 9:41 am EST
Hello almafly,

Excellent question about uploading files with PHP. While I'm happy to point you in the right direction for finding instructions on how to upload files to a database, I wanted to caution you regarding that practice first.

If you upload the actual files (not just file information) to the database, it may cause problems in the future for the server when you are trying to actually read those files from the database as that can be a very taxing process for the server. The best practice is to extract information about the file and store that information in the database while keeping the actual file stored in your account.

Here are links to the recommended method of uploading the file to the server and storing information about the file in a database:

http://php.about.com/od/phpwithmysql/ss/Upload_file_sql.htm

http://stackoverflow.com/questions/450876/upload-image-to-server-using-php-store-file-name-in-a-mysql-database-with-othe

If you decide to store the actual files in the database (not recommended) here are the links to instructions for that:

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

http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php

Please let us know if you have any questions or need any additional assistance.

Regards,

Christi N.

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.