Get the App
SLTechnology News&Howtos  ›  Database  › 

Save the film with mysql

Shulou Source: shulou.com Published: 2022-06-01 04:45:44 10月02日 Update

In the process of designing and building a web site, it is sometimes more convenient to save a copy to a database than to save it as a file. The combination of PHP and MySQL can easily implement the above functions. [@ more@] configure the number of databases

The difference between the fields of the text or integer type we usually use in the data database and the fields that need to be used to save the film is that the number of fields that the user needs to save is different. The MySQL database uses a specific field to hold high-volume data, which is of type BLOB.

The definition of MySQL data for BLOB is as follows: the BLOB data type is a large binary object that can hold available data. There are four types of BLOB, namely TINYBLOB,BLOB, MEDIUMBLOB and LONGBLOB, depending on the length of the maximum data they can store.

After describing the data types we need to use, we can use the following sentence to build a table of saved images.

Code: CREATE TABLE Images (PicNum int NOT NULL AUTO_INCREMENT PRIMARY KEY, Image BLOB)

Edit and upload the copy

As to how to upload documents, we will no longer discuss them here. Interested users can refer to the relevant articles in the "Internet Pottery Bar". Now, let's take a look at how to receive uploaded files and store them in the MySQL database. The specific version code is as follows, where we assume that the name of the delivery domain on the file is Picture.

Code:

Tags: Document program different field maximum function form program valid successful location can make large capacity size finished that is text article format template Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Huawei Xiaomi Shulou Technology Microsoft