Skip to content

demirtanzer/FileManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

FileManager

With this File Manager prepared for PHP/Js, you can perform all file operations on your server without any problems.


Instead of downloading and integrating the file manager I need in the projects I prepared, I decided to create both OOP experience and my own PHP FileManager class and a visual interface that I can use in this class.

Contrary to the standards, I do the version notification using the following method so that it is clear what content I am using during a possible change in the future.


Version features;


  • In FileManager.php v2 I used the FMP namespace and the fmp class name to further reduce the code complexity found in v1.
  • Unlike the previous version, in this version, graphic files are previewed with the "tempImage()" function in the class instead of standard icons.
  • Quick access thanks to the folder tree, which can be used on a screen with a resolution of 640px and above for ease of use.
  • Popup menus with customized jQuery-ui plugin
  • Multi-language support with xml format
  • Built-in FontAwesome 4 icons
  • The interface will not work without jQuery and console.log() will create a record
  • With the "config.xml" file, the root directory, color scheme and maximum file upload size can be specified.

FMP class in FileManager.php;


  1. First of all, I had to redefine functions such as mime_content_type() and realpath() in the class in order not to cause software errors between possible PHP versions.
  2. fmp->post($_POST variable)
    To be able to use the posted data securely. Returns "false" if the value is undefined/empty, otherwise returns the posted data.
  3. fmp->tempImage(imageLocation,desiredType,tempFolder)
    If there is no image sent in the specified tempFolder, it will be reduced to 45px*45px and saved in the tempFolder with a new name in md5() format. Returns null if imageLocation is not found, otherwise returns with image content
  4. fmp->details(adress)
    type(text file), graphic(true/false), server location(/home/dir/), web location(/dir), size( Returns 1mb), edit date(Ynd H:i:sa), and privacy(777)
  5. fmp->create(name,path,type)
    Creates the desired name and type (file/folder) at the specified path. Adds a number to the end of the filename if there is content with the same name in the specified path. If there is no error, it returns the name of the created content.
  6. fmp->fileSave(file,content)
    Replaces the contents of the file at the specified address. returns true/false
  7. fmp->listing(folder,requestType
    ) Returns the contents of the specified folder in the desiredType (all, folders only, only files) as an array variable.
  8. fmp->folderList(folder)
    On the contrary, fmp->listing() function returns only the folders in the specified folder in string format with comma marks (,) between them.
  9. fmp->download(file)
    It provides a secure download of the desired file by making the necessary header() definitions.
  10. fmp->delete(files)
    Deletes the file/s sent in both array and string form. Returns deleted and non-deletable filenames.
  11. fmp->move(files,movingFolder) Moves files,
    both array and string, to the specified moveFolder. Returns True/False.
  12. fmp->copy(files,copyFolder) Copies
    both array and string files to the specified copyFolder. Returns True/False.
  13. fmp->rename(oldName,newName)
    renames oldName content with newName.
  14. fmp->upload(files, uploadFolder) Uploads
    files sent either as array or string to the upload folder and names them according to the file existence. Returns with array elements named Error and done
  15. fmp->createZip(files,creationFolder)
    Creates a zip archive with both array and string files, in the specified creationFolder. It returns array elements named Error and done.
  16. fmp->unZip(archiveFile,folder)
    Extracts the specified archiveFile in the desired directory. Returns True/False.
  17. In case of a possible error in all operations , the error date, operation and necessary information are recorded in the "/manager/fm_error_log.txt" file.

About

With this File Manager prepared for PHP/Js, you can perform all file operations on your server without any problems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages