首页 > 开发 > PHP > 正文

建立文件交换功能的脚本(一)

2024-05-04 22:15:30
字体:
来源:转载
供稿:网友
因为工作的原因需要在局域网上安装一个文件交换的东西,也可以作成一个文件上下载的功能块。
用的是php,mysql,apache现将程序编写过程贴出来,因为作这个参考来oso的一些文章,也算是一个补充,
也表达我对前辈们的敬意。

准备工作在你的mysql的yourdatabase库中建一个表upfile
/*上传文件表
CREATE TABLE upfile (
id TINYINT (8) not null AUTO_INCREMENT,  //文件的id号
filename VARCHAR (80) not null,          //文件名
fileshow VARCHAR (80) not null,          //文件说明
date DATE not null,                      //上传日期
uploader VARCHAR (40) not null,          //上传者签名
type VARCHAR (40) not null,              //文件类型(人为定义)    
PRIMARY KEY (id)
)
*/

//这是该程序的主页面,用来显示上载的文件。
//index.php

<html>
<body bgcolor="#FFFFFF">
<head>
<title>文件交换</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">文件交换区</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">上载文件</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("无法连接数据库"); //连接书库库
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表