PurchTable purchaseTable;
System.Net.WebClient webClient;
System.IO.MemoryStream stream;
FileUploadTemporaryStorageResult fileUploadResult = File::GetFileFromUser (classstr(ImageFileUploadTemporaryStorageStrategy));
if (fileUploadResult && fileUploadResult.getUploadStatus())
{
str imageFilePathName = fileUploadResult.getDownloadUrl();
InteropPermission perm = newInteropPermission(InteropKind::ClrInterop);
perm.assert();
// BP Deviation Documented
webClient = new System.Net.WebClient();
// BP Deviation Documented
stream = newSystem.IO.MemoryStream(webClient.DownloadData(imageFilePathName));
select purchaseTable where purchaseTable.PurchId == "PO-0002"; // any record for tables
DocuRef docuref =DocumentManagement::attachFile(purchaseTable.TableId,purchaseTable.RecId, purchaseTable.DataAreaId,DocuType::typeFile(),stream,fileUploadResult.getFileName(), fileUploadResult.getFileContentType(),fileUploadResult.getFileName());
// download/view the attachment
str displayUrl = DocumentManagement::getAttachmentPublicUrl(docuref);
Browser br = new Browser();
br.navigate(displayUrl);
CodeAccessPermission::revertAssert();
}
thanks for great help...
0 yorum:
Post a Comment