# Uploader

The upload class simplifies the process of uploading files to the server. Every Controller class has its own upload class.


Max size

You can set the maximum allowed file size (expressed in Kb):


You can get the maximum allowed file size this way:



By default every file is uploaded to the public folder. But you can change the default directory this way:


This will upload any file to the public/images folder.

You can get the choosen directory this way:


Last file

To get information about the last file uploaded, you can use the getLastFile method:


That will return an array with information about the file name, file type, file size, directory, uploader IP, upload date and any upload error.

Format match

You can validate a file format using the matchFormat method.

It will return true if the file matches the formats especified:

$matches = $this->upload->matchFormat('examplefile', 'jpg, png, gif'));

You can pass a string separated by commas or an array like this:

$formats = array('jpg', 'png', 'gif');
$matches = $this->upload->matchFormat('examplefile', $formats));


First create a form in your view like this:

<form action="yourpage/upload" method="post" enctype="multipart/form-data">
     <input type="file" name="examplefile"/>
     <input type="submit" value="upload"/>

Then in your controller create a function named upload with the following code:

//Optional configuration


If the examplefile size isn't greater than 1000 Kb it will be uploaded to the public folder. You are done!