[原创]请教文件上传系统 |
处理页面:
<?php
$connect=@mysql_connect("localhost","ics2004","xxxx")or die("无法连接服务器");
$database=@mysql_select_db("ics2004",$connect)or die("无法连接数据库");
move_uploaded_file($file,"./file/".$filename.".txt");
$file=readfile("./file/$filename.txt");
$insert="insert into".$tablename."(title,content) values('$filename','$file')";
mysql_query($insert);
?>
表单页面
<form action='upload.php' method='post' enctype='multipart/form-data' name='form2' onsubmit='return check();'>
<div align='center' class='style1'>
请选择上传文件
<input type='file' name='file'>
<br>
请填写文章标题
<input type=text name=filename>
<input type='submit' name='Submit2' value='提交'>
</div>
</form>
出错提示:
Warning: readfile(): Unable to access ./file/.txt in /vhost/100steps/ics2004/upload.php on line 5
Warning: readfile(./file/.txt): failed to open stream: No such file or directory in /vhost/100steps/ics2004/upload.php on line 5
请高手们指点
|
|
|