edraw open file using HttpOpenFileFromStream in php
I am using this javascript code on load event
document.OA1.HttpInit();
document.OA1.HttpAddpostString("DocumentID", "sample5.docx");
document.OA1.HttpOpenFileFromStream("http://localhost/rte/action_open_file.php", "Word.Application");
php code action_open_file.php
header("http/1.1 200 OK");
$doc_file_name = $_REQUEST["DocumentID"];
$file_size = filesize($doc_file_name);
$file = fopen($doc_file_name,"r");
$data = fread($handle,$file_size);
fwrite($handle,$data);
fclose($handle);
But it opens empty file in web page but the sample5.docx has some text.
Your JS code is fine. Just replace your
action_open_file.phpcode with the following: