Created
March 28, 2022 18:49
-
-
Save jvanhoesen/609f1931b2d4040e8110736d163ad374 to your computer and use it in GitHub Desktop.
Retrieving a file from ZipArchive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Creates a stream from the specified file within the .ZIP file | |
using (Stream fileStream = zip.OpenRead(info.Name)) | |
{ | |
using(MemoryStream innerStream = new MemoryStream()) | |
{ | |
fileStream.CopyTo(innerStream); | |
//Create Acumatica file from .Zip file content | |
fileInfo = new PX.SM.FileInfo(info.Name, null, innerStream.ToArray()); | |
//Saves file to Invoice | |
if (uploadFileMaint.SaveFile(fileInfo, FileExistsAction.CreateVersion)) | |
{ | |
PXNoteAttribute.AttachFile(Base.Document.Cache, Base.Document.Current, fileInfo); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment