The UploadDataAsync method uploads the asynchronous data.
Namespace – ABSuite.AccessLayer.Connector.Core
Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)
Syntax
Task<bool> UploadDataAsync( byte[] data, string virtualPath )
Arguments
data – System.Byte
This argument specifies the data to be uploaded.
virtualPath – System.String
This argument specifies the virtual path where the data is uploaded.
Return Value
This method returns true if the data upload is successful; otherwise, it returns false.
Using the IFileRepositoryService Interface for the UploadDataAsync Method
The following code is an example of using the UploadDataAsync method:
// Upload a file to the server repository. FileUploadMessage fUploadMsg = new FileUploadMessage(); fUploadMsg.VirtualPath = ("Images"); Stream fs = File.OpenRead("c:\\temp\\FREPOS\\Images\\Test.jpg"); fUploadMsg.Stream = ConvertStream(fs); bool bUploadOK = fileRepos.Upload(fUploadMsg); // This method converts the filestream into a byte array private byte[] ConvertStream(Stream myStream) { System.IO.MemoryStream data = new System.IO.MemoryStream(); System.IO.Stream str = myStream; str.CopyTo(data); data.Seek(0, SeekOrigin.Begin); byte[] buf = new byte[data.Length]; data.Read(buf, 0, buf.Length); return buf; }