Shows the given file contents in a content-appropriate way.
The type of the content is supplied by either the MIME type or the filename, at least one of which must be supplied. The content itself should be presented as a base64-encoded string. Not all file types may be supported on all platforms.
<static> showAttachmentContents_CONT( contents, mimeType, fileName, waitDialogCallbackString )
Name | Type | Description |
contents | string | The base-64 encoded version of the binary content of the attachment to be displayed. |
mimeType | string | The MIME type of the file. |
fileName | string | The name of the file. |
waitDialogCallbackString | anonymous.genericCallbackFunction | The callback function used to close a wait dialog once the attachment is done opening. |
var openAttachmentBase64StringPng = function() { // How you want get the base 64 encoding of the file is up to you. This string represents a small png image. var data = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA0SURBVFhH7dAxEQAACAMx3CAT6eVQwZKh8/dSmc7n6jN+bQcIECBAgAABAgQIECBAgACBBb3SkJeQ67u1AAAAAElFTkSuQmCC"; hwc.showProgressDialog(); // Don't have to pass the filename because we are passing the MIME type. hwc.showAttachmentContents_CONT( data, "image/png", null, "hwc.hideProgressDialog()" ); }
var openAttachmentBase64StringTxt = function() { // How you want get the base 64 encoding of the file is up to you. This string represents a short text file. var data = "VGhpcyBpcyBwYXJ0IG9mIGEgaHlicmlkIGFwcC4="; // Don't have to pass the MIME type because we are passing the filename. hwc.showAttachmentContents_CONT( data, null, "attach.txt" ); }