Chapter 11: Storing Binary Data in MySQL - Build Your Own DatabaseDriven Website Using PHP amp;amp; MySQL [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Build Your Own DatabaseDriven Website Using PHP amp;amp; MySQL [Electronic resources] - نسخه متنی

Kevin Yank

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








Chapter 11: Storing Binary Data in MySQL


Overview


In the previous chapter, we developed a system whereby users could upload
image files and have them stored on your Web server for display on your site.
In developing this system, we had to tackle several issues:



Ensure that non-conflicting file names are generated.



Synchronize stored files with the database by adding an entry
for each file as it is uploaded.



Delete old files when their database entries are deleted.



While I've demonstrated that these constraints can be met, after 10
chapters of pushing the advantages of relational databases, you may have been
surprised that I didn't opt for a solution where the files were stored in
the database.

In cases where you're dealing with relatively small files, for example,
head shots for use in a staff directory, the storage of data in MySQL is,
in fact, quite practical. In this chapter, I'll demonstrate how to use PHP
to store binary files uploaded over the Web in a MySQL database, and how to
retrieve those files for download or display.

/ 190