Using Google Docs Viewer to preview documents online

PHP, PHP Code Generator, PHP Form Generator, Tutorials

Google Docs Viewer provides an excellent option to preview Office documents online. No need to download them to end user machine, no need to have any Office software installed. Supported formats are Microsoft Word, Microsoft Excel and PDF.

Syntax is quite simple:<url of your document>

Today we’ll see how you can use this feature in PHPRunner applications. In PHPRunner you have two upload options: Basic and Advanced upload controls. In both cases you need to set ‘View as’ type of upload field to custom.

Basic upload control:

$value = "<a target=_blank href='".$value."'>".$value."</a>";

Replace with path to the folder where your files are stored.

Advanced upload control:

$fileArray = my_json_decode($value);
for($i = 0; $i < count($fileArray); $i++)
	$value .= "<a target=_blank href='".$fileArray[$i]["name"]."'>".
		$fileArray[$i]["usrName"]."</a> ";

Replace with the path of your web application.

This is it. Enjoy!

1 thought on “Using Google Docs Viewer to preview documents online

  1. I read that it allows file only up to 25 MB ?
    is that correct, yes than is there any way to increase ?
    Thanks & regards

Leave a Reply

Your email address will not be published. Required fields are marked *