For work reasons, you need to install a file exchange item on the LAN, or you can create a function block for downloading files.
PHP, MySQL, and Apache are used. Program Post the compilation process because some Oso Article Is a supplement,
I also pay tribute to my predecessors.
Prepare to create an upfile table in your MySQL yourdatabase database.
/* Upload a file table
Create Table upfile (
Id tinyint (8) Not null auto_increment, // ID of the file
Filename varchar (80) not null, // file name
Fileshow varchar (80) not null, // file description
Date not null, // upload date
Uploader varchar (40) not null, // uploaded Signature
Type varchar (40) not null, // file type (manually defined)
Primary Key (ID)
)
*/
// This is the main page of the program, used to display uploaded files.
// Index. php
<HTML>
<Body bgcolor = "# ffffff">
<Head>
<Title> file exchange </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</Head>
<Div align = "center">
<Table width = "500" border = "0" cellspacing = "0" cellpadding = "0" Height = "25">
<Tr>
<TD Height = "25">
<Div align = "center"> file exchange zone </div>
</TD>
</Tr>
</Table>
<Table width = "600" border = "0" cellspacing = "0" cellpadding = "0" Height = "20">
<Tr>
<TD Height = "25" width = "75">
<Div align = "center"> <a href = "Upload. php"> upload a file </a> </div>
</TD>
</Tr>
</Table>
<Table width = "600" border = "0" cellspacing = "0" cellpadding = "0" Height = "79">
<Tr valign = "TOP">
<TD>
<Div align = "center"> <?
$ Db = mysql_connect ("$ hostname", "$ user", "$ password") or die ("unable to connect to Database"); // connect to the library
Mysql_select_db ("yourdatabse", $ dB) or die ("unable to Open Database ");
$ SQL = "select * From upfile ";
$ Result = mysql_query ($ SQL );
If ($ myrow = mysql_fetch_array ($ result ))
{
Echo "<Table border = 1> \ n ";
Echo "<tr> <TD> file name </TD> <TD> upload date </TD> <TD> uploaded by </TD> <TD> file description </TD> <TD> file type </TD> </tr> \ n ";
Do
{
Printf ("<tr> <TD> <a href = \".. /file/% s \ "> % S </a> </TD> <TD> % S </TD> <TD> % S </TD> <TD> % S </TD> </tr> \ n ", $ myrow ["FILENAME"], $ myrow ["FILENAME"], $ myrow ["date"], $ myrow ["Uploader"], $ myrow ["fileshow"], $ myrow ["type"]);
}
// List all files for download.
While ($ myrow = mysql_fetch_array ($ result ));
Echo "</table> </P> \ n ";
}
Else
{
Echo "no file in the file exchange area <br> <a href = 'index. php'> return </a> ";
}
?> </Div>
</TD>
</Tr>
</Table>
</Div>
</Body>
</Html>