infosophie / file
PHP Librar for working with files
README
File is still under development. It is a PHP library for working with files.
Currently, there is only one class (Upload), which is used to upload files.
Installation
Composer
composer require infosophie/file
In composer.json:
"require": {
"infosophie/require": "^0.2"
}
Usage
Upload
An object of the Upload class represents a file to be uploaded. The object can generate the upload form, read the file from the request, and display its contents or save it to the file system.
To use the class in a composer project just "use" the classes like
use Infosophie\File\Upload;
If you manually installed Infosophie/File you first have to require the file holding the class:
include "path/to/infosophie_file/Upload.php";
use Infosophie\File\Upload;
Later in your script you create a new Object:
$upload = new Upload('my_upload_file', ['text/plain'], ['txt']);
call the provided functions, e.g. print the form for the user to upload the file
echo $upload->htmlForm();
or get the content of the file uploaded with that form:
$content = $upload->getContent();
more to come...