Last active
March 29, 2016 06:23
-
-
Save smarenich/ebfb5399b31b4b694fe8 to your computer and use it in GitHub Desktop.
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
public const string SessionKey = "MyFileImportSessionKey"; | |
public PXAction<GLTran> UploadFileBatch; | |
[PXUIField(DisplayName = "Upload File as Batches", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Visible = true)] | |
[PXButton()] | |
public virtual IEnumerable uploadFileBatch(PXAdapter adapter) | |
{ | |
//Ask user to upload file, continue if it is OK | |
if (this.NewFilePanel.AskExt() == WebDialogResult.OK) | |
{ | |
//Retreaving file from session by key | |
PX.SM.FileInfo info = PXContext.SessionTyped<PXSessionStatePXData>().FileInfo[SessionKey] as PX.SM.FileInfo; | |
//Binary data will be inside FileInfo | |
Byte[] bytes = info.BinData; | |
//Removing file from session to save memory | |
System.Web.HttpContext.Current.Session.Remove(SessionKey); | |
} | |
return adapter.Get(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment