修改webftp,線上檔案管理

來源:互聯網
上載者:User

標籤:c   style   class   blog   code   java   

項目中要添加一個檔案管理功能,允許使用者維護自己的靜態HTML檔案。

在網上找了一個現成的線上PHP檔案管理工具:webftp :http://down.chinaz.com/soft/30675.htm

下載後發現有一些問題:

  • 他必須登入才可以使用
  • 上傳的檔案類型沒有限制
  • 介面不是很方便嵌入項目中
  • 指定自己的檔案操作路徑

我將他修改了一下。基本滿足了我的需求。

登入問題,將他的登入頁面修改為自動登入。

檔案限制,修改 \webftp\static\js\webftp.upload.js 檔案中的filters值。修改 \webftp\core\FileFS.class.php 在檔案上傳的地方添加代碼如下:

$ext = strtolower($_FILES[‘file‘][‘name‘]);$ext = explode("." , $_FILES[‘file‘][‘name‘]);$ext = end($ext);$ext_list = array(‘js‘, ‘png‘, ‘jpg‘, ‘html‘, ‘tpl‘, ‘css‘); if (!in_array($ext, $ext_list)){        $tihs->error = ‘file ext error!‘;    return false;}

介面的話,直接修改index.php檔案就好。

效果如下:

修改檔案操作路徑 修改 \webftp\init.php 中的 ‘ROOT_PATH‘ => ‘./storage/a1/‘ 和 C(‘ROOT_PATH‘, ‘./storage/a1/‘);

下載:http://files.cnblogs.com/zjfree/webftp.rar

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.