Remote API Implementation > Writer > Sample Code - PHP

Sample Code - PHP

Tags:  

PHP Sample


When you wish to edit and save your document using Zoho Writer's editor to your remote server, you need to do a form submit from your application to Zoho Writer as mentioned here.

The response for this form will be a Zoho Writer editor with the content of the document loaded. After editing your document, when you press save, Zoho Writer converts the document to the required format(doc/pdf/sxw...etc.,) specified in the above form and sends the modified content to the saveurl.

Assume your saveurl is - http://yourwebsite.com/SaveDoc.php

This is how your SaveDoc.php will look like:

<?php

$tmp_filename = $_FILES['content']['tmp_name'];

$upload_status = move_uploaded_file($tmp_filename,"[Specify the absolute path where the document is to be stored along with the filename and file extension]");

?>


Below is the brief explanation of what the code does:

$_FILES['content']['tmp_name'] - The $_FILES array is where PHP stores all the information about files. There are two elements of this array which we need to understand:

content - content is the reference we assigned in our HTML form.

tmp_name - tmp_name contains the path to the temporary file that resides on the server.

move_uploaded_file - This function moves the temporary file to the location in your local server that you mention along with the file name and file extension. For example the remote server path could look like - /apache/htdocs/remotesave/test.doc.


 


 RSS of this page