How to get the content of a file sent via POST in Laravel 4?
laravel-4, php
Solution
If you're posting a text file to than it should already be on the server. As per the laravel documentation, `Input::file` returns an object that extends the php class `SplFileInfo` so this should work:
$book->SummaryText = file_get_contents($file->getRealPath());
I'm not sure if the php method `file_get_contents` will work in the Laravel framework...if it doesn't try this:
$book->SummaryText = File::get($file->getRealPath());
Problem
I have a form that sends a text file via POST method in Laravel 4. Inside the Controller, however, I can't figure out how to get its content in order to put it into a BLOB field in the DB. Laravel's documentation and all the posts I found into the web, always show how to save the content into a file with the `->move()` method. This is my code in the Controller: ``` $book = Books::find($id); $file = Input::file('summary'); // get the file user sent via POST $book->SummaryText = $file->getContent(); <---- this is the method I am searching for... $book->save(); // save the summary text into the DB ``` (SummaryText is a MEDIUMTEXT on my DB table). So, how to get the file content in Laravel 4.1, without having to save it into a file? Is that possible?