Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.