First, you get the uploaded file object.. like so:
$file = Input::file('file');
$tempPath =$file->getRealPath();
Note that you don't really need to 'move' the file to another folder since it is going into db. Next, you capture the 'contents' of the (temp) file and move into the desired database column:
DB::table('tablename')->insert(array(
'doc_attachment'=> File::get($tempPath) );
(of course, ample error checking is warranted for file operations.. but this is the basic idea)
Thanks!
Why would you save the contents in the database? Just save the filename and use the filesystem to store files..
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community