I'm using Laravel + Slim to build an application.
I have a form with file upload and I managed successfully to get the information from text inputs:
$request = $app->request;
$title = $request->post('title');
But how I can get the properties like size, name, tmp_name, etc. from a file input?
I found this question and tried like that but I get this error:
Fatal error: Call to undefined method Slim\Http\Request::file()
There is couple of method you can apply while you uploading some file(s) using laravel's. Here is the couple of them and most important to, in my thought.
hasFile
method to check user upload file or not.isValid
method take care to check file have no error.After these checks, you have to get file properties and move to desired location. For these purposes.
Get the document information object. So after that you can use further helper function provided my laravel FileUploader.
and finally to move the uploaded file
update
However if you using slim to upload file, you have to use native php methods like globals
Files
array to get file and move_uploaded_file to move file and like so.If you still have any question related to upload a file or file validation let me know.