public
Description: PHP 5 library for the Vuzit AJAX document viewer web services API
Home | Edit | New

Vuzit_Document_upload

Vuzit_Document upload function

Uploads a document to the Vuzit web service.

Signatures

  • public static Document upload($path, $options = null)

Parameters

  • string $path : Path to a file on the file system.
  • array $options : Options for the uploaded file. See “Options” below.

Options

Options for the array.

  • download_document – bool : Specifies if the original document (such as a DOC, XLS, PDF, PPT file) is downloadable via the viewer control bar. The value is either “true” or “false”.
  • download_pdf – bool : Specifies if the generated PDF file, if the originating document was not a PDF, is downloadable via the viewer control bar. The value is either “true” or “false”.
  • secure – bool : Specifies whether the document should be public or private. The value is either “true” or “false”.
  • file_type – string : The short extension of the file type of the document to be uploaded (e.g. pdf, doc, ppt, etc.) This parameter is required if the file does not have an extension in the filename, and specifying this parameter overrides any existing extension that appears in the filename.

Return type

  • Document : The new document with an ID. None of the other properties will be available. You’ll need to use the findById method to load them.

Usage Examples

Simple upload example.


Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');  

$doc = Vuzit_Document::upload("c:/path/to/document.pdf");  

echo "Document id: " . $doc->getId();

Example that sets the “secure” and “file_type” options for the document.


Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');  

$doc = Vuzit_Document::upload("c:/path/to/document.pdf", array("secure" => true, 
                                                               "file_type" => "pdf"));  

echo "Document id: " . $doc->getId();

Last edited by bmatzelle, Tue Oct 27 19:44:16 -0700 2009
Home | Edit | New
Versions: