奈斯涂咪涂u
验证文件的路径
qq_缔造者_03554660
请采纳,谢谢!
慕移动4504380
路径不对或者是文件不存在
慕粉1422042299
createFile
simon_wyk
fopen需要两个必选参数
qq_KungfuPander_0
就是没有传参数进去啊,在前面加 @ 就好了
慕粉3513192
zd666
已经自己解决了
zd666
require_once 'dir.func.php';
require_once 'file.func.php';
路径对吗?
astro842
我是自己重新建立一个项目,要添加的东西很多,JQuery ui文件夹要添加,images文件夹要添加,index.php里面把他的JS拿过来,table拿一部分,还要设置你这个调用的路径
阳光细雨0
源码不是可以下载吗
阳光细雨0
他有源码啊,是全部做完的源码,要这个阶段的源码没有,要自己重新建立项目然后把要的东西COPY过来
qq_百度信誉认证中心蒲超_0
可能是你的代码有问题,再仔细检查一遍代码
幻风释青春
下载的原文件里有个坑
老师视频里面代码是这样的:
<td>请输入文件名称</td>
<td >
<input type="text" name="filename" />
<input type="hidden" name="path" value="<?php echo $path;?>"/>
<input type="hidden" name="act" value="createFile"/>
<input type="submit" value="创建文件"/>
</td>
下载的源码是:
<td>请输入文件名称</td>
<td >
<input type="text" name="filename" />
<input type="hidden" name="path" value="<?php echo $path;?>"/>
<input type="submit" name="act" value="创建文件" />
</td>
注意一下就好
lhb0268
一般出现乱码问题都是你的游览器编码和你编程序保存的编码不同所导致的,弹出的文字出现乱码可能是你的js语言(你应该是单独保存的一个文本吧)编码不同 可能需要加一个设置编码的头文件
慕粉3684285
if (isset($_POST['act'])) {
$act = $_POST['act'];
}else{
$act = null;
}if (isset($_POST['filename'])) {
$filename = $_POST['filename'];
}else{
$filename = null;
}
人艰不拆8
<form action="index.php" method="psot" enctype="multipart/form-data">
...........
</form>
LTrelieved
应该是script你写错了
ansiphp
检查一下自己JS有没有写错
Scny
我觉得你这就挺好的啊
Charliezhang
$arr=explode(".",$val);
$ext=strtolower(end($arr));
将index.php324行的代码代码改成上面的两行代码就行了,我遇到了解决了
面瘫兔子
自己解决了,在index.php页面里if判断的时候少了个=。我用的=,应该是==
肥一磅的感觉
可以百度
慕先生4263394
对,不懂这是什么意思,不要这个参数照样正常啊
LINDLTAILOR
我刚刚试了,不加和加了的效果一样,我觉得加逗号应该是看起来更清楚点
萧萧520
建议你去看看PHP的单引号和双引号的区别;
简单说双引号中可以输出变量,特殊字符不会被转义。给你出个题:
$user = "刘德华"; $username = "华仔"; echo "$username"; // 输出什么?
答案是输出“华仔”,这次采用的是最长匹配,性能肯定很低,因为做了太多无意义的判断。
echo "{$user}name";明确输出的是$user,避免歧义。
xiadaomeng
顾城imooc
再附上小弟自己的index.php代码:
<?php
require("dir.func.php");
require("file.func.php");
//require("common.func.php");
$path = "file";
$act = $_REQUEST['act'];
$filename = $_REQUEST['filename'];
$info =readDirectory($path);
//print_r($info);
//$redirect="index.php?path={$path}";
if($act=="创建文件"){
//创建文件
//echo $path."--";
//echo $filename;
//$mes = createFile($path."/".$filename);
//alertMes($mes,$redirect);
echo $path."--";
echo $filename;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>insert title here</title>
<link rel="stylesheet" href="cikonss.css" />
<style type="text/css">
body,p,div,ul,ol,table,dl,dd,dt{
margin: 0px;
padding: 0px;
}
a{
text-decoration: none;
}
ul li {
list-style: none;
float: left;
}
#top{
width:100%;
height:48px;
margin:0 auto;
background: #E2E2E2;
}
.small{
width:25px;
height:25px;
border:0;
}
#navi a{
display: block;
width:48px;
height: 48px;
}
</style>
<script type="text/javascript">
function show(dis){
document.getElementById(dis).style.display="block";
}
</script>
</head>
<body>
<h1>慕课网-在线文件管理器</h1>
<div id="top">
<ul id="navi">
<li><a href="index.php" title="主目录"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-home"></span></span></a></li>
<li><a href="#" onclick="show('createFile')" title="新建文件"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-file"></span></span></a></li>
<li><a href="#" onclick="show('createFolder')" title="新建文件夹"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-folder"></span></span></a></li>
<li><a href="#" onclick="show('uploadFile')" title="上传文件"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-upload"></span></span></a></li>
<li><a href="#" title="返回上级目录"><span style="margin-left: 8px; margin-top: 0px; top: 4px;" class="icon icon-small icon-square"><span class="icon-arrowLeft"></span></span></a></li>
</ul>
</div>
<table width="100%" border="1" cellpadding="5" cellspacing="0" bgcolor="#ABCDEF" align="center">
<tr id="createFolder" style="display:none;">
<td>请输入文件夹名称</td>
<td >
<input type="text" name="dirname" />
<input type="submit" name="act" value="创建文件夹"/>
</td>
</tr>
<tr id="createFile" style="display:none;">
<td>请输入文件名称</td>
<td >
<input type="text" name="filename" />
<input type="hidden" name="path" value="<?php echo $path;?>"/>
<input type="hidden" name="act" value="createFile"/>
<input type="submit" value="创建文件" />
</td>
</tr>
<tr id="uploadFile" style="display:none;">
<td >请选择要上传的文件</td>
<td ><input type="file" name="myFile" />
<input type="submit" name="act" value="上传文件" />
</td>
</tr>
<tr>
<td>编号</td>
<td>名称</td>
<td>类型</td>
<td>大小</td>
<td>可读</td>
<td>可写</td>
<td>可执行</td>
<td>创建时间</td>
<td>修改时间</td>
<td>访问时间</td>
<td>操作</td>
</tr>
<?php
$i=1;
if($info['file']){
foreach ($info['file'] as $val) {
$p = $path.'/'.$val;
?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $val;?></td>
<td><?php $src=filetype($p)=="file"? "file_ico.png" : "folder_ico.png"?><img src="images/<?php echo $src;?>" alt="" title="文件"></td>
<td><?php echo transByte(filesize($p))?></td>
<td><?php $src=is_readable($p)==true?"correct.png":"error.png"; ?><img class="small" src="images/<?php echo $src; ?>"</td>
<td><?php $src=is_writeable($p)==true?"correct.png":"error.png"; ?><img class="small" src="images/<?php echo $src; ?>"</td>
<td><?php $src=is_executable($p)==true?"correct.png":"error.png"; ?><img class="small" src="images/<?php echo $src; ?>"</td>
<td><?php echo date("Y-m-d H:i:s",filectime($p));?></td>
<td><?php echo date("Y-m-d H:i:s",filemtime($p));?></td>
<td><?php echo date("Y-m-d H:i:s",fileatime($p));?></td>
<td>
<!--<a href="#" onclick="showDetail('<?php echo $val;?>','<?php echo $p;?>')"><img class="small" src="images/show.png" alt="" title="查看"/></a>|-->
<a href="index.php?act=showContent&path=<?php echo $path;?>&filename=<?php echo $p;?>" ><img class="small" src="images/show.png" alt="" title="查看"/></a>|
<a href="index.php?act=editContent&path=<?php echo $path;?>&filename=<?php echo $p;?>"><img class="small" src="images/edit.png" alt="" title="修改"/></a>|
<a href="index.php?act=renameFile&path=<?php echo $path;?>&filename=<?php echo $p;?>"><img class="small" src="images/rename.png" alt="" title="重命名"/></a>|
<a href="index.php?act=copyFile&path=<?php echo $path;?>&filename=<?php echo $p;?>"><img class="small" src="images/copy.png" alt="" title="复制"/></a>|
<a href="index.php?act=cutFile&path=<?php echo $path;?>&filename=<?php echo $p;?>"><img class="small" src="images/cut.png" alt="" title="剪切"/></a>|
<a href="#" onclick="delFile('<?php echo $p;?>','<?php echo $path;?>')"><img class="small" src="images/delete.png" alt="" title="删除"/></a>|
<a href="index.php?act=downFile&path=<?php echo $path;?>&filename=<?php echo $p;?>"><img class="small" src="images/download.png" alt="" title="下载"/></a>
</td>
</tr>
<?php
$i++;
}
}
?>
</table>
</body>
</html>
ticoin
那条时光流转的小巷