Documentation
addFile
usage
FilesUploader->addFile( $_FILES[ string variable_name] , string $key )
paramètres
variable_name : the name of the input inside the form
key: a name to allow to identify the file and get it back later when uploaded and moved in the right place
adds a file to upload (usually contained in the superglobal array $_FILES)
exemples
<?php
include('../Kernel/common/file.class.php');
if(sizeof($_FILES)>0){
$folder = new Folder('/media/');
$picturesFolder = $folder->createDirectory('images');
$uploader = new FilesUploader();
$uploader->addFile( $_FILES['picture'] , 'profilePic' );
$uploader->setTarget( $picturesFolder );
$uploader->execute();
echo $uploader->getFile('profilePic')->getName();
}
?>
<form enctype="multipart/form-data" method="post">
<input type="file" name="picture"/><input type="submit"/>
</form>