I'm facing a problem that I use PHPword
for uploading
and showing
the content of doc,docx
file with laravel
. I searched and just find the way create doc file. So I need a help for solution for 'read and show' doc file with phpword. I upload file same like laravel-excel
.
Here is my code:
+ upload form:
<form method="post" action="doc/upload" enctype="multipart/form-data">
{{csrf_field()}}
<input type="file" name="file" accept=".doc, .docx"/>
<button class="btn btn-primary" style="margin-top: 5px"><span class="glyphicon glyphicon-import" aria-hidden="true"></span> Upload</button>
</form>
+ processing:
public function upload(Request $request){
$file = $request->file('file');
$phpWord = \PhpOffice\PhpWord\IOFactory::load($file);
dd($phpWord);
}