ubbedit实现遍历绝对目录绑定cookie查询以前上传的图片

admin5年前前端技术1072

设置cookie ,$user_id=$_COOKIE["user_email"];

设置path   , $path =  "/".$user_id.$CONFIG['fileManagerListPath'];

获取文件列表: 修改成如下

/* 获取文件列表 */  
//$path = $_SERVER['DOCUMENT_ROOT'] . (substr($path, 0, 1) == "/" ? "":"/") . $path;
$path = "C:/Users/frank/Desktop/website/images.ubb.com".$path;


遍历获取目录下的指定类型的文件

 修改:'url'=> substr($path2, strlen("C:/Users/frank/Desktop/website/images.ubb.com")),

function getfiles($path, $allowFiles, &$files = array())
{
    if (!is_dir($path)) return null;
    if(substr($path, strlen($path) - 1) != '/') $path .= '/';
    $handle = opendir($path);
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            $path2 = $path . $file;
            if (is_dir($path2)) {
                getfiles($path2, $allowFiles, $files);
            } else {
                if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
                    $files[] = array(
                        'url'=> substr($path2, strlen("C:/Users/frank/Desktop/website/images.ubb.com")),
                        'mtime'=> filemtime($path2)
                    );
                }
            }
        }
    }
    return $files;
}

action_list.php文件下载


完整精简配置好的UBB下载


相关文章

jquery 生成的dom无法触发click事件的解决方案

原因是程序找不到此节点在jQuery中有“向未来的元素添加事件处理程序”方法说明,也正是动态创建元素无法触发事件的原因所在。正确的写法应该是:$(‘父元素’).on(‘click’,’动态的子元素’,...

ubbedit文件精简,删除所有用不到的文件,设置新的路径调用

ubbedit文件精简,删除所有用不到的文件,设置新的路径调用

移动editor_api.js文件从ex目录到ubbedit目录,设置 baseURL = '/ubbedit/_src/';设置Gruntfile.js文件 js...

ios 手机端 input 框上方有内阴影

解决方案1:<!--如果 ui 样式里有边框,可以用外层盒子设置边框-->input{     border:none; }...

通过jQuery Ajax使用FormData对象上传文件,实现uedito文本编辑器独立上传单个图片的功能

FormData对象,是可以使用一系列的键值对来模拟一个完整的表单,然后使用XMLHttpRequest发送这个"表单"。在 Mozilla Developer ...

Navigate down the menu through jquery development

The core knowledge is to use jquery's hover method to achieve, The animation effe...

通过jquery开发导航下来菜单

核心知识是用jquery的hover方法去实现,动画效果是slideDown与slideUp代码下载地址:点击下载...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。