21,886
社区成员
发帖
与我相关
我的任务
分享
<form id="fileupload" action="uploader.php" method="post"><h3>上传书籍</h3><br/>
<input type="file" name="file" id="file" value="上传txt文件"><br/>
<input type="text" name="name" id="name" title="输入书名,默认文件名为书名">输入书名<br/>
<input type="hidden" name="permission" id="permission" value=2>
<input type="button" value="submit" onclick="this.form.submit()">
……
echo $_POST['file'];// 输出 xxx.txt, 没有路径
$lenth = 0;
$string = array();
$context = stream_context_create($string);
$string = file_get_contents($_POST['file'], false, $context, $lenth) or die("Error before get contents");// 在这个地方提示$_POST['file']不对
$output = explode(chr(13), $string);
……