My requirement is to upload a PDF file to a specific location on the server. The PDF file will be selected using a file input field.
I have created a view with a file input field and in the controller I have added the following code which gets fired when the form is submitted but the files array is displayed as empty.
$files = Upload::get_files();
print_r($files);
I am new to fuelphp, therefore please give me some pointers on how to get this working.
Thanks.
You will need to process your uploaded files first, using Upload::process().
This will validate all uploads, and process all successful uploads according to the configuration. After that, you can call get_files() to get all valid files, and get_errors() to get all invalid files. Use save() to save all valid files to their final destination, depending on the configuration.
I have already tried using Upload::process but still the $files array shows up as empty.
Upload::process(array(
'path' => './uploads',
'normalize' => true,
'change_case' => 'lower'
));
$files = Upload::get_files();
print_r($files);