CREATE TABLE ccs_image (
id int(4) unsigned NOT NULL auto_increment,
description varchar(250) default NULL,
bin_data longblob,
filename varchar(50) default NULL,
filesize varchar(50) default NULL,
filetype varchar(50) default NULL,
PRIMARY KEY (id)
)
-->
<HTML>
<HEAD>
<TITLE>
</TITLE></HEAD>
<BODY>
<php
if (isset($_POST['submit'])) {
$form_description = $_POST['form_description'];
$form_data_name = $_FILES['form_data']['name'];
$form_data_size = $_FILES['form_data']['size'];
$form_data_type = $_FILES['form_data']['type'];
$form_data = $_FILES['form_data']['tmp_name'];
$connect = MYSQL_CONNECT( "localhost", "root","123456" ) or die("不能连接服务器");
mysql_select_db( image) or die("不能连接数据库");
$data = addslashes(fread(fopen($form_data, r), filesize($form_data)));
$result=MYSQL_QUERY("INSERT INTO ccs_image (description,bin_data,filename,filesize,filetype) VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");
$id= mysql_insert_id();
MYSQL_CLOSE();
} else {
>
<center>
<form method=post action=UPloadphp enctype=multipart/form-data>
文件描述:
<br>
<input type=text name=form_description size=40>
<br>
<INPUT TYPE=hidden name=MAX_FILE_SIZE value=1000000>
<br>
<!--File to upload/store in database: -->
请选择上传文件:
<br>
<input type=file name=form_data size=40>
<br>
<input type=submit name=submit value=确定>
</form>
</center>
<php
}
>
</BODY>
</HTML>1把存档的名字改成world,放到你服务器的文件夹里
2把serverproperties里面的level-name改成你存档的名字(不可以是中文),也是把存档放到你服务器的文件夹里
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)