Php directory file manager

Файловый менеджер на PHP, с правами, контролем версий и AJAX-ом

Особенности файлового менеджера:
— Можно задавать права доступа на файлы и директории. Права двух типов: есть доступ или нет доступа. Файлы хранятся в недоступной для скачивания по прямой ссылке папке. Скачивание файла происходит с предварительной проверкой пользователя и прав доступа на файл. Любой пользователь файлового менеджера может обладать правами администратора, что указывается при добавлении нового или редактировании существующего пользователя. Администратор может видеть все, в том числе «удалённые» файлы.
— Контроль версий каждого файла. После загрузки файла он сохраняется с именем, которое не позволяет перезаписать существующие файлы, а его «оригинальное» имя сохраняется в БД. Данный подход разрешает хранить разные состояния файлов.
— Автоматическое создание превью загружаемых изображений.
— Файл в менеджере можно сделать доступным для скачивания
— GPL, код доступен на github

FM создан без использования фреймворков. Это довольно обычное MVC приложение, где основные действия контроллера могут быть вызваны AJAX запросом, например:
— при инициализации приложения вызывается AJAX контроллер /ajax/fm/?action=files, функция files() в зависимости от текущей директории, которая хранится в сессии, получает список файлов и директорий.
— клик на файле делает активным DIV с а в зависимости от выбранной вкладки диалогового окна получает необходимые данные для текущего файла.

Пройдя по ссылке можно ознакомиться с основами функционирования приложения.

Для загрузки файлов используется Ajax Upload. Он поддерживает мультизагрузку и позволяет загружать файлы, переместив их drag&drop-ом на кнопку «Загрузка файлов». Главный недостаток: Ajax Upload не работает на планшетных (Android) устройствах.

Установка:
1) Скачать код файлового менеджера github
2) Создать базу данных и пользователя для доступа к базе. Дамп хранится в папке /sql/fm.sql
3) Распаковать исходный код системы в любую директорию веб-сервера
4) Выставить права на запись для необходимых директорий:
/cache/ /upload/ /upload/_thumb/

5) Отредактировать файл /system/config.ini:
; включить кеширование, ускоряет выполнение php скриптов
twig_cache = false

; пути, используемые системой, менять не нужно
[path]
application = «/system/»
library = «/system/library/»
controller = «/system/Controller/»
templates = «/system/View/templates/»
layouts = «/system/View/layouts/»
cache = «/cache»
upload = «upload/»

[fm]
; максимальный размер загружаемого файла в байтах
sizeLimit = 10485760
; цвет фона для создаваемых превьюшек и качество сжатия JPEG
rgb = 0xFFFFFF
quality = 100

; параметры для доступа к БД
; т.к. используется PDO можно использовать другие базы
[db]
adapter = «mysql»
host = «localhost»
username = «»
password = «»
dbname = «»
6) Открыть в браузере файловый менеджер. Для входа filemanager/filemanager
Логин/Пароль пользователя с правами администратора

Читайте также:  Php pdo sqlite install

1) Ajax Upload
valums.com/ajax-upload/
2) Иконки типов файлов: OSX 3.3

P.S. В demo файлового менеджера нельзя сделать какие-то изменения. ReadOnly, это специально.
Интерфейс файлового менеджера довольно прост, если проект заинтересует — над интерфейсом обещаю потрудиться.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

File manager in a single php file

License

alexantr/filemanager

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A good solution for managing files and folders for developers who can’t access their site over SSH or FTP.

PHP File Manager

WARNING! Do not use this script as a regular file manager in public area. After all actions you must delete this script from the server.

  • PHP 5.2 or higher.
  • Zip extension for zip and unzip actions.
  • Fileinfo, iconv and mbstring extensions are strongly recommended.

Download ZIP with the latest version from the master branch.

Copy filemanager.php to your website folder and open it in a web browser (e.g. http://yoursite/any_path/filemanager.php).

Default username/password: fm_admin/fm_admin

Warning! Please set your own username and password in $auth_users before use.

To enable or disable authentication set $use_auth to true or false .

For better security enable HTTP Authentication in your web server.

You can include file manager in another script. Just define FM_EMBED and other necessary constants. Example:

class SomeController < public function actionIndex() < define('FM_EMBED', true); define('FM_SELF_URL', UrlHelper::currentUrl()); // must be set if URL to manager not equal PHP_SELF require 'path/to/filemanager.php'; > >
  • FM_ROOT_PATH — default is $_SERVER[‘DOCUMENT_ROOT’]
  • FM_ROOT_URL — default is ‘http(s)://site.domain/’
  • FM_SELF_URL — default is ‘http(s)://site.domain/’ . $_SERVER[‘PHP_SELF’]
  • FM_ICONV_INPUT_ENC — default is ‘CP1251’
  • FM_USE_HIGHLIGHTJS — default is true
  • FM_HIGHLIGHTJS_STYLE — default is ‘vs’
  • FM_DATETIME_FORMAT — default is ‘d.m.y H:i’
Читайте также:  Java security privilegedactionexception null

If you have any issues with file manager, you may report them on Issue tracker.

This software is released under the MIT license.

Источник

In this php scripts we list some useful php scripts for file directory manager.

FileGator

filegator

Advanced Multi-User PHP File Manager & AJAX Uploader

PHP Directory Explorer

php-directory-explorer

PHP Directory Explorer is a directory indexing script written in PHP which indexes all folders, sub-folders, and files within a directory with style and simplicity.

Client Directory Enforcer – Easy htaccess/htpasswd

client-directory-enforcer

Clients Demo Enforcer is an admin interface that lets you manage folders protected with htacess. htaccess/htpasswd combo is a powerful combination to to protect entire folders with a single file.

Aberrant File Browser

aberrant-file-browser

Aberrant File Browser is a PHP script designed as a drop-in, lightweight replacement for the default directory listing pages generated by web servers like Apache.

File List Class

file-list-class

The File List Class helps you get listings of folders in your file system. Not only will you be able to retrieve your files, you can also sort them and filter them as you so please.

Tastydir – an AJAX file manager and dir listing

tastydir-ajax-file-manager-dir-thing

Tastydir is a cross-platform PHP file management system which allows you to not only replace your traditional FTP client but also allow your users to view directories in a much more aesthetically pleasing way.

File Explorer Class

file-explorer-class

This class gives you the ability to easily delete, create, move, copy files and directories with content.

Customer-friendly Download Login

Customer-Friendly Download Login - Easy and secure file sharing

It doesn’t need a database, so the setup ist very easy, just upload the files and be sure the PHP script has writing access.

Sleek Directory Navigator

sleek-directory-navigator

Directory Navigator script allows you to display any directory on your website in an easy view format. All content is displayed in ascending alphabetical order with an option to switch from ascending to descending by clicking on the folder/file count text above the the files and folders.

PHP File Directory Explorer

php-file-directory-explorer

PHP File Directory Explorer is a lightweight php script (the whole script sums only one file in total, excluding the small images) which can be used to browse your files fast and easy.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

josantonius / php-file Public archive

PHP library for file and directory management.

Читайте также:  Python string formatting number

License

josantonius/php-file

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

PHP library for file management.

This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.

The preferred way to install this extension is through Composer.

To install PHP File library, simply:

composer require Josantonius/File 

The previous command will only install the necessary files, if you prefer to download the entire source code you can use:

composer require Josantonius/File --prefer-source 

You can also clone the complete repository with Git:

Or install it manually:

wget https://raw.githubusercontent.com/Josantonius/PHP-File/master/src/File.php 

Available methods in this library:

— Check if a file exists in a path or url

# Return (boolean)

# Return (boolean)

— Create directory if not exists

# Return (boolean)

— Copy directory recursively

File::copyDirRecursively($from, $to);
Attribute Description Type Required Default
$from Path from copy. string Yes
$to Path to copy. string Yes

# Return (boolean)

# Return (boolean)

— Delete directory recursively

File::deleteDirRecursively($path);

# Return (boolean)

# Return (boolean)

To use this library with Composer:

require __DIR__ . '/vendor/autoload.php'; use Josantonius\File\File;

Or If you installed it manually, use it:

require_once __DIR__ . '/File.php'; use Josantonius\File\File;

Example of use for this library:

— Check if a local file exists

— Check if a external file exists

File::exists('https://raw.githubusercontent.com/Josantonius/PHP-File/master/composer.json');
File::delete(__DIR__ . '/test.txt');
File::createDir(__DIR__ . '/test/');
File::deleteEmptyDir(__DIR__ . '/test/');

— Delete directory recursively

File::deleteDirRecursively(__DIR__ . '/test/');

— Copy directory recursively

File::copyDirRecursively(__DIR__ . '/test/', __DIR__ . '/copy/');

— Get file paths from directory

get_class(File::getFilesFromDir(__DIR__));

To run tests you just need composer and to execute the following:

git clone https://github.com/Josantonius/PHP-File.git cd PHP-File composer install 

Run PSR2 code standard tests with PHPCS:

Run PHP Mess Detector tests to detect inconsistencies in code style:

This repository is licensed under the MIT License.

About

PHP library for file and directory management.

Источник

Оцените статью