Zend - The PHP Company




Files and Directories

Add Code


a class to Get and Output Directories List  

Type: class
Added by: llgdholland
Entered: 24/12/2000
Last modified: 01/12/2000
Rating: - (fewer than 3 votes)
Views: 15148
A framework to get the directories list at a given path and possibly print it, core or as ht-links to each directory (useful if each contains an index.htm for ex) ... to be extended


Bs_CsvUtil  

Type: class
Added by: blueshoes
Entered: 05/11/2002
Last modified: 01/11/2001
Rating: - (fewer than 3 votes)
Views: 6316
comma separated values - read and write Features: supports any separator char sequence, default is semicolon ";". supports separator characters in the values. eg you use a ; as separator, your line may look like blah;hello world;"foo";"foo;bar";"this is a ""string""";got it?;foo as you can see, the values can be in "quotes". if your text uses quotes itself as in the "string" example, they are escaped in ms-style with 2 quotes. and by using quotes we can even have your separator inside the text (example "foo;bar"). line breaks. a csv line may spread over multiple lines using crlf in a field value. see the checkMultiline param and the _checkMultiline() method. this class is part of the blueshoes application framework.


Bs_IniHandler  

Type: class
Added by: blueshoes
Entered: 09/11/2002
Last modified: 01/11/2001
Rating: - (fewer than 3 votes)
Views: 5027
The IniHandler can read and write ini-style files (and strings). Many options can be set.


C64 disk reader (D64 files)  

Type: class
Added by: tonypeters
Entered: 02/04/2001
Last modified: 04/12/2000
Rating: - (fewer than 3 votes)
Views: 6690
Class to read Commodore 64 .D64 files. This will produce a listing of the contents of the disk in an array with all details (see example). This was mainly produced as a test of PHP's file handling functions and class implementation (which I think it handles quite well!)


Create Path  

Type: code fragment
Added by: jijutm
Entered: 01/11/2006
Last modified: 02/11/2005
Rating: - (fewer than 3 votes)
Views: 2461
Creates deep directory structrure path to any depths.


Directory Index'r  

Type: code fragment
Added by: blue7
Entered: 26/08/2001
Last modified: 08/12/2000
Rating: *** (9 votes)
Views: 16518
function that reads directory content and returns the result as links to every file in the directory. toss it into any directory as index.php and get a list of links to every file


Directory Recursion  

Type: code fragment
Added by: kuzb
Entered: 23/12/2001
Last modified: 01/12/2001
Rating: - (fewer than 3 votes)
Views: 9119
This handy little function will, given a starting directory, return an array of directories contained within the original directory. It does this by using recursion, a process by which a function calls itself repeatadly, until all conditions are met. Syntax is Array RecurseDir (string starting_directory)


disk usage  

Type: code fragment
Added by: danielsan
Entered: 03/02/2002
Last modified: 02/12/2001
Rating: - (fewer than 3 votes)
Views: 9006
Returns disk usage in bytes of directory $d. Limit depth level with $depth.


Document Auto Linker And Display  

Type: application
Added by: jiwang
Entered: 17/06/2001
Last modified: 06/12/2000
Rating: - (fewer than 3 votes)
Views: 8596
This script will auto link any text file in table manners in selected directory, and auto link them. Great for website like Olga, lyrics and tabs


Download Security  

Type: class
Added by: jmaurin
Entered: 29/07/2003
Last modified: 09/12/2002
Rating: **** (4 votes)
Views: 6748
This class block any download from unauthorized site to your files. You can also share files stored in non-web folder.


dynamic array of directory contents  

Type: code fragment
Added by: armelino
Entered: 28/05/2002
Last modified: 06/12/2001
Rating: - (fewer than 3 votes)
Views: 8416
This code dynamically lists the (video) files in a directory, loads them into an array, sorts them by name (without the extension), and then displays them with a thumbnail link to the actual (video) file. It also displays the size of the files in kb. I wrote this after giving up on the other array and sort code that I'd seen. None of them seemed to do all of this at once. Note that the .jpg thumbnails that link to the movies all have the same prefix name (the substring is identical). This allows the link to work. A simple text link would have done the same thing.


Easy news  

Type: code fragment
Added by: IceCreamMan
Entered: 26/03/2002
Last modified: 03/12/2001
Rating: - (fewer than 3 votes)
Views: 8522
Updat the news section on your site easily without using a database.


F&DB&CV2  

Type: code fragment
Added by: abadon
Entered: 04/07/2002
Last modified: 07/12/2001
Rating: - (fewer than 3 votes)
Views: 6101
Files and Directories Browser and Source Code Viewer... not anything special


File Grabber with Random Photo Display  

Type: class
Added by: bicycle
Entered: 26/08/2003
Last modified: 09/12/2002
Rating: - (fewer than 3 votes)
Views: 5600
Looks in any directory you specify and gets all the files with extensions given by you. Returns them as an array that you can do anything with, I used it to pick four photos from the photo album directory at random (sort of random) and display them in the footer of a page. Works around open_basedir restrictions.


File & Folder Picker / Selector for PHP  

Type: code fragment
Added by: CHnuschti
Entered: 21/10/2003
Last modified: 02/11/2002
Rating: - (fewer than 3 votes)
Views: 9860
Hi. I wrote this one for "local" purposes. It allows to navigate and pick up an unlimited amount of files and folders. It returns a 2-dim-array with the file/folderpath and an index: 1=folder, 2=file. It requires javascript. It was tested "local" on Windows2000 and IE6, but not on an "external" server nore with other browsers. You'll have to adapt the list of the drives manually.


File and dir listing into tables, with download support  

Type: application
Added by: phpie
Entered: 24/08/2001
Last modified: 08/12/2001
Rating: **** (12 votes)
Views: 18312
The function of this script is to distinguish wether the returned array is a file or directory, if it is a file, it generates a link to download the file, otherwise if it's a dir, it creates a link to list the files/dirs in that directory, works on windows and *nix platforms.


File Search  

Type: code fragment
Added by: dwebb
Entered: 26/09/2000
Last modified: 01/12/2000
Rating: - (fewer than 3 votes)
Views: 7222
This function allows your script to search through a directory tree for a file. The search is depth first. The fully qualified file name is returned if the file is found.


File Search Class  

Type: class
Added by: g3voodoo
Entered: 18/08/2001
Last modified: 08/12/2000
Rating: - (fewer than 3 votes)
Views: 6979
This is a simple class that will let you search specified directories on your server, using specified file extensions, for a query string.


file.php  

Type: application
Added by: bleach
Entered: 06/03/2000
Last modified: 09/12/2010
Rating: **** (24 votes)
Views: 30712
This is a early version of a filesystem editor we wrote for our developers kit. It allows you do view a directory, create files, erase files, edit files, create directories, remove directories, and upload files from your browser directly into the directory.


Filemanager class  

Type: class
Added by: gnarf
Entered: 20/04/2004
Last modified: 03/12/2004
Rating: - (fewer than 3 votes)
Views: 5429
The filemanager class can be used to create a php filemanger, you can define a chrooted kind of basedir, and use the $_GET array to define a subdir. It has some built in protection against "?subdir=../" stuff and it has alot of little extras, like sort functions, MIME type checks and lots more. I have been using it a long time now, and it never failed me :)


Find File Name  

Type: code fragment
Added by: jay_chack
Entered: 17/09/2000
Last modified: 01/12/2000
Rating: - (fewer than 3 votes)
Views: 6366
This generalized code snippet finds out the current file name without the extension part and can be of use in any template driven site where you have to dynamically generate names of graphics or other files to be loaded depending on the name of the page loading. Being generalised it doesnt matter how comlicated the URL is or how deep the current file is embedded. It still pulls out the name correctly.


Format a File Size  

Type: code fragment
Added by: kingtech
Entered: 16/05/2001
Last modified: 09/12/2000
Rating: - (fewer than 3 votes)
Views: 5711
Function for calculating and formating a file size in bytes to human readble format


Format Filesize  

Type: code fragment
Added by: marcjon
Entered: 24/07/2004
Last modified: 07/12/2003
Rating: - (fewer than 3 votes)
Views: 3844
I wrote this for my message board. It takes a int which is bytes, and makes a string to represent the filesize in a cleaner format, like 1.56 KB or 56 GB. It has a optional second parameter, bytesstyle, which if set to one will add (n bytes) at the end of the string returned. If for some reason you need values bigger than TB (right now I can't imagine where) but you can simply copy one of the if ($int >1024+... code and somply replace the value of $str. Other styles can be added easily by copying the if ($str != " bytes" AND $bytesstyle == 1){$str .= " (".$bytes." bytes)";} snipplet and change the $bytesstyle value. The +256 are for precision. You could also add a negative value and get returns like 0.95KB. With the setting of positive, you get values such as 1154 MB.


format_filesize  

Type: code fragment
Added by: danielsan
Entered: 03/02/2002
Last modified: 02/12/2001
Rating: - (fewer than 3 votes)
Views: 4647
format_filesize choses the best human readable unit for $bytes returns a formatted string


FTP stats  

Type: code fragment
Added by: Navex
Entered: 19/06/2003
Last modified: 09/12/2002
Rating: - (fewer than 3 votes)
Views: 4328
This script parses FTP wu-ftp log file (xferlog) and show some stats sorted by username. Total bytes, bytes by day, incoming and outcoming totals


Function ftp_dget() for downloading direcotry of files via FTP  

Type: application
Added by: HitByASquirrel
Entered: 15/06/2003
Last modified: 09/12/2002
Rating: - (fewer than 3 votes)
Views: 5121
This function wil download all files and subdirectories recursively if need be from a specified directory on a aremote server. It works just like other PHP ftp functions.


Get directory list  

Type: code fragment
Added by: Fantazs
Entered: 15/12/2000
Last modified: 01/12/2000
Rating: *** (4 votes)
Views: 14058
You can get file list (in array) from start directory and it subdirectories.


Global Replace  

Type: application
Added by: RLYNCH
Entered: 13/02/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 6742
A global search and replace using PHP. You'll need to specify several parameters as GET/POST parameters: oldword=[text to replace] newword=[new text] rootpath=[path to dir containing files to alter] Note also that PHP must have read/write access to the files to alter them.


Last edited file in a dir script.  

Type: code fragment
Added by: inter
Entered: 13/07/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 6077
Show's the last edited file in a directory


LBN File Manager  

Type: application
Added by: musician214
Entered: 06/12/2003
Last modified: 02/11/2002
Rating: - (fewer than 3 votes)
Views: 7074
List All Entries in a Directory in Alphabetical Order. Create Directories, Upload Files, Rename Files and Directories, Delete Files and Directories, Edit Files, Set Permissions (modes) for Files and Directories.


list and link to all images, and include all their information  

Type: code fragment
Added by: armelino
Entered: 28/01/2002
Last modified: 02/12/2001
Rating: - (fewer than 3 votes)
Views: 6740
This code allows you to dynamically list a directory's image files, creates links to them, and tells you their size in pixels and kilobytes.


Man Page Lookup  

Type: class library
Added by: amnuts
Entered: 10/01/2002
Last modified: 01/12/2003
Rating: - (fewer than 3 votes)
Views: 5405
This class allows you to view man pages through a browser. The man page is formatted correctly, and includes highlighting and italics where appropriate. Email addresses can automatically be rendered into clickable links. Not only can you enter the man page to view, but you can also list all man pages available on the system, or all man pages starting with a certain alpha, numeric, or non-alphanumeric characters.


Match line  

Type: code fragment
Added by: robf
Entered: 21/03/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 6454
return the first line in a given file containing the given string


MP3 ID3 v1.x Read and Write  

Type: class
Added by: fatihhood
Entered: 23/07/2004
Last modified: 07/12/2003
Rating: - (fewer than 3 votes)
Views: 7986
Read and write ID3 v1.0 and v1.1 tags of MP3 files. This class is meant to access MP3 audio files with meta-information tags ID3v1.0 and ID3v1.1 . The class can find the ID tags to extract the the audio track meta-information that describes items like the title, artist, album, year, track and music genre. The class can also update MP3 files to write or remove the ID tags with the track meta-information.


PHP_FTP  

Type: class
Added by: ryanflynn
Entered: 27/06/2001
Last modified: 04/12/2007
Rating: ***** (6 votes)
Views: 11232
Alot of people have asked for VERY simple FTP functionality with PHP, so here it is. This class was designed with very simplistic transfers in mind. You simple create the class, get/send a file and then 'kill()' the object. It's that simple. I you find it useful.


Pick up a random item from a file  

Type: code fragment
Added by: jay_chack
Entered: 18/09/2000
Last modified: 01/12/2000
Rating: - (fewer than 3 votes)
Views: 5902
Without loading the memory pick up a random item from a text file to display a random item e.g. Quotable quotes, a URL, address of a graphics file or even a code segment etc.


Print Directory  

Type: application
Added by: benmurphy
Entered: 21/09/2002
Last modified: 09/12/2001
Rating: - (fewer than 3 votes)
Views: 5807
This will take an assigned directory and print out its content, hyperlinking to each file and printing the results on the page with out the .php extension. works great if you have a small site and you want to use it for navagtion.


Random File  

Type: code fragment
Added by: robf
Entered: 17/03/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 7269
Picks a file at random from the given directory. Accepts wildcards.


Random picture/file function  

Type: code fragment
Added by: DarthZeth
Entered: 29/05/2002
Last modified: 06/12/2001
Rating: - (fewer than 3 votes)
Views: 5112
I designed this specifically as a random picture generator, but im sure it can be used for many things. You make a directory with the pictures that you want to randomly select. Using this funciton, you just use the directory as the aurgument and it returns the path of a random file in that directory.


read write copy files and URLs without permissions issues  

Type: code fragment
Added by: xpc
Entered: 18/08/2001
Last modified: 08/12/2000
Rating: - (fewer than 3 votes)
Views: 8513
These functions are very simple, useful and powerful. They allow you to retreive a url as a variable that can be cached, reloaded, transformed and or saved. No need for CHMOD or file permissions issues when copying, saving, editing, or writing to files.


recursive directory listing  

Type: code fragment
Added by: MoreDread
Entered: 06/03/2003
Last modified: 04/12/2002
Rating: - (fewer than 3 votes)
Views: 5857
This mini-script lists your directory structure from a starting point. Nothing special - but small and far from complex and not used for a certain purpose. You could modify and use it for whatever you need.


RPM Filename Parser  

Type: code fragment
Added by: ying
Entered: 18/02/2001
Last modified: 02/12/2000
Rating: - (fewer than 3 votes)
Views: 4831
A function to check if a given filename is an RPM (ends with ".rpm") and if so will return an associative array with the Name, Version, Revision, and Architecture.


search  

Type: code fragment
Added by: h3
Entered: 10/12/2004
Last modified: 01/12/2004
Rating: - (fewer than 3 votes)
Views: 3618
This function was widely inspired by dwebb's File Search function (see: http://www.zend.com/codex.php?id=301&single=1) It's basically the same function but now it returns an array to support multiple matches, it's also more flexible because I used stristr() instead of a literal match, wich is quite useless for a search function...


Search and Replace  

Type: code fragment
Added by: richardhey
Entered: 20/05/2000
Last modified: 08/12/1999
Rating: ***** (6 votes)
Views: 8693
A script that performs a search and replace function. Written because I didn't have one at the time. Can perform over multiple files and/or directories. Can be configured to ignore certain lines.


SERVER-TO-SERVER site (or single dir) transfer  

Type: application
Added by: bluaqua
Entered: 22/10/2002
Last modified: 31/10/2001
Rating: ***** (3 votes)
Views: 6370
Place this script in a directory of your site and it will transfer via ftp all nested dirs and files to another server (of course it may be the same server).Don't lose time downloading and then uploading.Let the server do it all.Instructions and comments to code included.


sikil  

Type: application
Added by: idban
Entered: 16/08/2001
Last modified: 08/12/2000
Rating: - (fewer than 3 votes)
Views: 6014
sikil ( seekandkill ) this tool originaly make for helping mweb Indonesia developer/designer/admin to find useless file on our servers, i.e DEADJOE file or .html~ using /dev/stdin, and run only in linux machine


spidermanuk  

Type: code fragment
Added by: spidermanuk
Entered: 02/09/2002
Last modified: 09/12/2001
Rating: - (fewer than 3 votes)
Views: 3886
tests to see if an image file (jpg/gif..) exists and if it does not then it can display alternative text! Good to use if your website in underconstrucion and you are waiting for someone else to add images as they get them. No more explorer missing image icons!


Tryon FS  

Type: application
Added by: gtryonp
Entered: 21/06/2005
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 3042
Upload/Download files, navigate/create folders with password protected login (without database) and with JUST *ONE* 8Kb FILE!


ULTIMATE File Management  

Type: application
Added by: kb9uia
Entered: 25/07/2001
Last modified: 07/12/2000
Rating: - (fewer than 3 votes)
Views: 11180
This FIl eManager needs PHP Only and does making directories, uploading files, viewing, renameing, deleting, EDITING! i just cant get the glimps dir thing to work or the back to root and the view (the glimps dir/root) otherwise, its FULLY functional!


WebExplorer  

Type: application
Added by: sune
Entered: 17/04/2000
Last modified: 02/12/2000
Rating: **** (8 votes)
Views: 11598
I used to use Gossamer Threads "File Manager" written in Perl, but decided to write my own in PHP.

This application lets you edit, browse, CHMOD, view, move, rename, copy, upload and create files/directories in any forms/tables enabled browser.
(Option to create html skeleton-files.)

newest version is always available at http://www.suneworld.com/programs
Thanks to Bleach for inspiration (file.php)

(Go to http://www.suneworld.com/programs to download needed gifs.


WriteConfigFile 2.5b - Manipulate PHP-conform config files  

Type: class
Added by: MaierMan
Entered: 29/01/2003
Last modified: 02/12/2002
Rating: - (fewer than 3 votes)
Views: 5114
Class "WriteConfigFile" is a tool to manipulate simple config-files in php-script style. It is able to create or manipulate files which later can be included directly into php-scripts. It is able to write bool, numericals, string and (multi-dim) arrays. Code is designed to to avoid many different file writes. It also fixes problems with some permission-systems which reset attributes after modification.


XCOPY in PHP  

Type: code fragment
Added by: php_guy
Entered: 23/06/2003
Last modified: 09/12/2002
Rating: - (fewer than 3 votes)
Views: 5351
This function copy all the files and directories (including all sub directores) from target to source like XCOPY command.


XCOPY in PHP  

Type: code fragment
Added by: imranlink
Entered: 08/08/2004
Last modified: 08/12/2003
Rating: - (fewer than 3 votes)
Views: 4883
This function copy all the files and directories (including all sub directores) from target to source like XCOPY command with simplest way.


ZIP File Maker  

Type: class library
Added by: pnoeric
Entered: 21/09/2001
Last modified: 09/12/2000
Rating: ***** (30 votes)
Views: 46005
Code class to create "zip" files on the fly.



Search



This Category All Categories