diff --git a/README.md b/README.md index c69341ac..dca88587 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ [![Live demo](https://img.shields.io/badge/Live-Demo-brightgreen.svg?style=flat-square)](https://tinyfilemanager.github.io/demo/) -[![Live demo](https://img.shields.io/badge/Help-Docs-lightgrey.svg?style=flat-square)](https://tinyfilemanager.github.io/) +[![Live demo](https://img.shields.io/badge/Help-Docs-lightgrey.svg?style=flat-square)](https://github.com/prasathmani/tinyfilemanager/wiki) [![GitHub Release](https://img.shields.io/github/release/qubyte/rubidium.svg?style=flat-square)](https://github.com/prasathmani/tinyfilemanager/releases) [![GitHub License](https://img.shields.io/github/license/prasathmani/tinyfilemanager.svg?style=flat-square)](https://github.com/prasathmani/tinyfilemanager/blob/master/LICENSE) [![Paypal](https://img.shields.io/badge/Donate-Paypal-lightgrey.svg?style=flat-square)](https://www.paypal.me/prasathmani) -> It is web based file manager and it is a simple, fast and small file manager with a single file, multi-language ready web application for storing, uploading, editing and managing files and folders online via web browser. The Application runs on PHP 5.5+, It allows the creation of multiple users and each user can have its own directory and a build-in support for managing text files with cloud9 IDE and it supports syntax highlighting for over 150+ languages and over 35+ themes. +> TinyFileManager is web based file manager and it is a simple, fast and small file manager with a single file, multi-language ready web application for storing, uploading, editing and managing files and folders online via web browser. The Application runs on PHP 5.5+, It allows the creation of multiple users and each user can have its own directory and a build-in support for managing text files with cloud9 IDE and it supports syntax highlighting for over 150+ languages and over 35+ themes. ## Demo [Demo](https://tinyfilemanager.github.io/demo/) @@ -43,7 +43,7 @@ To enable/disable authentication set `$use_auth` to true or false. - :cd: Open Source, light and extremely simple - :iphone: Mobile friendly view for touch devices -- :information_source: Basic features likes Create, Delete, Modify, View, Quick View, Download, Copy and Move files +- :information_source: Basic features likes Create, Delete, Modify, View, Quick Preview, Download, Copy and Move files - :arrow_double_up: Ajax Upload, Ability to drag & drop, upload from URL, multiple files upload with file extensions filter - :file_folder: Ability to create folders and files - :gift: Ability to compress, extract files (`zip`, `tar`) diff --git a/tinyfilemanager.php b/tinyfilemanager.php index eca2a680..3d274259 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -3,13 +3,13 @@ $CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":false,"hide_Cols":false,"calc_folder":false}'; /** - * H3K | Tiny File Manager V2.4.0 + * H3K | Tiny File Manager V2.4.1 * CCP Programmers | ccpprogrammers@gmail.com * https://tinyfilemanager.github.io */ //TFM version -define('VERSION', '2.4.0'); +define('VERSION', '2.4.1'); //Application Title define('APP_TITLE', 'Tiny File Manager'); @@ -413,6 +413,14 @@ fclose($fd); die(true); } + + //search : get list of files from the current folder + if(isset($_POST['type']) && $_POST['type']=="search") { + $dir = FM_ROOT_PATH; + $response = scan($_POST['path'], $_POST['content']); + echo json_encode($response); + exit(); + } // backup files if (isset($_POST['type']) && $_POST['type'] == "backup") { @@ -789,27 +797,50 @@ function get_file_path () { $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true; $targetPath = $path . $ds; - $fullPath = $path . '/' . $_REQUEST['fullpath']; - $folder = substr($fullPath, 0, strrpos($fullPath, "/")); + if ( is_writable($targetPath) ) { + $fullPath = $path . '/' . $_REQUEST['fullpath']; + $folder = substr($fullPath, 0, strrpos($fullPath, "/")); - if(file_exists ($fullPath) && !$override_file_name) { - $ext_1 = $ext ? '.'.$ext : ''; - $fullPath = str_replace($ext_1, '', $fullPath) .'_'. date('ymdHis'). $ext_1; - } + if(file_exists ($fullPath) && !$override_file_name) { + $ext_1 = $ext ? '.'.$ext : ''; + $fullPath = str_replace($ext_1, '', $fullPath) .'_'. date('ymdHis'). $ext_1; + } - if (!is_dir($folder)) { - $old = umask(0); - mkdir($folder, 0777, true); - umask($old); - } + if (!is_dir($folder)) { + $old = umask(0); + mkdir($folder, 0777, true); + umask($old); + } - if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) { - if (move_uploaded_file($tmp_name, $fullPath)) { - die('Successfully uploaded'); - } else { - die(sprintf('Error while uploading files. Uploaded files: %s', $uploads)); + if (empty($f['file']['error']) && !empty($tmp_name) && $tmp_name != 'none' && $isFileAllowed) { + if (move_uploaded_file($tmp_name, $fullPath)) { + // Be sure that the file has been uploaded + if ( file_exists($fullPath) ) { + $response = array ( + 'status' => 'success', + 'info' => "file upload successful" + ); + } else { + $response = array ( + 'status' => 'error', + 'info' => 'Couldn\'t upload the requested file.' + ); + } + } else { + $response = array ( + 'status' => 'error', + 'info' => "Error while uploading files. Uploaded files $uploads", + ); + } } + } else { + $response = array ( + 'status' => 'error', + 'info' => 'The specified folder for upload isn\'t writeable.' + ); } + // Return the response + echo json_encode($response); exit(); } @@ -1114,7 +1145,10 @@ function getUploadExt() { toast('Error: Server Timeout'); }); }).on("success", function (res) { - console.log('Upload Status >> ', res.status); + let _response = JSON.parse(res.xhr.response); + if(_response.status == "error") { + toast(_response.info); + } }).on("error", function(file, response) { toast(response); }); @@ -1351,7 +1385,7 @@ function getChecked($conf, $val, $txt) {