I have problem that showing the content or docx
file in php(laravel 5)
.
I did not find any solution to show the content. I use phpword
lib for reading, I read the document of phpword but not find the solution.
Here is my code:
+upload in html:
<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>
+ process:
public function upload(Request $request){
$file = $request->file('file');
$phpWord = \PhpOffice\PhpWord\IOFactory::load($file);
//i use this line below for showing but it can not show exactly
$phpWord->save('php://output');
}