| |||||

| Field | Description |
| content | actual document content |
| filename | filename of the document with extension (supported formats : .doc, .rtf, .odt, .sxw, .html, .txt) |
| id | unique id that will be submitted while saving the document (for reference) |
| format | the format in which document should be saved on remote server (examples: doc, html, pdf, sxw, odt, rtf, txt ) |
| persistence(optional) | if this parameter is not passed or set to false, the document pushed to ZohoWriter will be editable only once. When the user exits the browser window, it will be automatically deleted |
| saveurl | [REMOTE SERVER SAVE URL] - The Web URL should be a service that fetches the content of the updated document and saves it to the user specified location. |
<form method="POST" action="http://export.writer.zoho.com/remotedoc.im?apikey=[apikey]&output=editor" enctype="multipart/form-data" target="_self">
File : <input type="file" name="content" size="38"> <br>
<input type="hidden" name="filename" value="mydocument.doc">
<input type="hidden" name="saveurl" value="[REMOTE SERVER SAVE URL]">
<input type="hidden" name="id" value="12345678">
<input type="hidden" name="format" value="doc">
<input type="submit" value="Edit" class="divbutton" name="submit">
</form>
URL=[url value1]
WARNING=[warning message]
RESULT=[TRUE/FALSE]
URL=http://export.writer.zoho.com/editor.im?doc=C77076EG003waI770c1
WARNING=
RESULT=TRUE
| Field | Description |
| url | url from which zoho writer can fetch the document. Note : it is mandatory to specify the absolute path of the document in url parameter with proper file extension. |
| filename | filename of the document with extension |
| id | unique id that will be submitted while saving the document (reference) |
| format | the format in which document should be saved on remote server (examples: doc, html, pdf, sxw, odt, rtf, txt ) |
| persistence(optional) | if this parameter is not passed or set to false, the document pushed to ZohoWriter will be editable only once, when the user exits the browser window it will be automatically deleted |
| saveurl | [REMOTE SERVER SAVE URL] - The Web URL should be a service that fetches the content of the updated document and saves it to the user specified location. |
<form method="POST" action="http://export.writer.zoho.com/remotedoc.im?apikey=[apikey]&output=editor" target="_self">
<input type="hidden" name="url" value="[REMOTE DOCUMENT URL]">
<input type="hidden" name="saveurl" value="[REMOTE SERVER SAVE URL]">
<input type="hidden" name="filename" value="mydocument.doc">
<input type="hidden" name="id" value="12345678">
<input type="hidden" name="format" value="pdf">
<input type="hidden" name="persistence" value="true">
<input type="submit" value="Edit" class="divbutton" name="submit">
</form>
URL=[url value1]
WARNING=[warning message]
RESULT=[TRUE/FALSE]
URL=http://export.writer.zoho.com/editor.im?doc=C77076EG003waI770c1
WARNING=
RESULT=TRUE
| Field | Description |
| format | the format in which the document should be saved on the remote server (examples: doc, html, pdf, sxw, odt, rtf, txt ) |
| content | document content in desired format |
| filename | filename of the document with extension |
| id | unique id that was initally sent while pushing the document from remote server (reference) |
<?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]");
?>
'this is page load event
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'declaring variable - object declared to get the file upload content
Dim m_objFile As HttpPostedFile
Dim filename As String
'here we get the request file name
m_objFile = Request.Files("content")
'here we are getting the exact file name what we send in the input html
filename = m_objFile.FileName().Substring(m_objFile.FileName().IndexOf("_") + 1)
'saving the path in the local server
Request.Files("content").SaveAs("C:\inetpub\" + filename)
End Sub
import org.apache.struts.action.*;
import java.util.logging.Logger;
import java.util.logging.Level;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletInputStream;
import java.util.Hashtable;
import java.io.*;
import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
public class MySaveService extends Action {
public ActionForward execute (ActionMapping actionMap, ActionForm actionForm, HttpServletRequest httpReq, HttpServletResponse response) throws Exception {
OutputStream out=null;
response.setCharacterEncoding("UTF-8");
out=response.getOutputStream();
DiskFileUpload upload = new DiskFileUpload();
upload.setSizeMax(-1);
java.util.List list = upload.parseRequest(httpReq);
java.util.Iterator items = list.iterator();
String docName = null;
byte[] htmlStrInBytes = null;
String id = null;
String format = "doc";
String url=null;
String filename=null;
while (items.hasNext()) {
FileItem item = (FileItem) items.next();
if (item.getFieldName().equalsIgnoreCase("content"))
{
htmlStrInBytes = item.get(); //The modified content sent by the zohowriter service is saved in this variable htmlStrInBytes
}
if (item.getFieldName().equalsIgnoreCase("format"))
{
byte[] fmt = item.get();
format = new String(fmt);
}
if (item.getFieldName().equalsIgnoreCase("id"))
{
byte[] id1 = item.get();
id = new String(id1);
}
if (item.getFieldName().equalsIgnoreCase("filename"))
{
byte[] filename1 = item.get();
filename = new String(filename1);
}
}
int tmp=filename.indexOf(".");
if(tmp>=0)
{
filename=filename.substring(0,tmp)+"."+format;
}
String path ;//Specify the path where the document is to be stored
File f = new File(path);
FileOutputStream fos = new FileOutputStream(f);
if(f.exists())
{
fos.write(htmlStrInBytes);//Writing the content into the file
}
fos.close();
return null;
}
}