All the methods for uploading a document are in the DocumentFactory class. Uploading the document can be done in chunks to show a progress bar and optionally allow the user to abort the application. Following are the steps required to perform this operation:
The application should first prompt the user for the location of the document and then obtain a file stream object with read access to the original file.
Create an instance of UploadDocumentOptions that can be populated with any optional values and then call the BeginUpload method. This method will return a temporary URL object to identity created by the DocumentFactory to identity this document for subsequent calls. This is a custom URL value in the following scheme
leadcache://unique_guid_identifier and is not meant to be used by anything other than the rest of the upload methods. This value must be saved in the application in a local variable at this point.
Read a chunk from the source file into a byte array. The size of this chunk is up to the user, the larger the chunk size, the shorter the whole upload operation but a too large of a chunk might throttle the server connection. A value of 64K is a good minimum. Once the chunk is read, call the DocumentFactory.UploadDocument method passing the URL value obtained from BeginUpload and the chunk of data.
Repeat till all the file is read and uploaded. Then simply call the LoadFromUri method as usual when loading a document from a remote URL, the DocumentFactory class will check the value of the URL and can identity that this is an uploaded document that does not have access to the physical file and instead parses the document from the uploaded data. The data is stored in the cache and is disposed when the Document object is disposed and its cache items are expired.
At any point during uploading the document, DocumentFactory.AbortUploadDocument can be called to abort the operation and DocumentFactory will delete the data uploaded so far from the cache immediately.
For an example, refer to DocumentFactory.BeginUpload.
Medical Web Viewer .NET