You can get the filename like this:
UploadFileMaintenance uploadFileMaintenance = PXGraph.CreateInstance<UploadFileMaintenance>();
foreach (Guid note in PXNoteAttribute.GetFileNotes(cache, dacRecord))
{
FileInfo file = uploadFileMaintenance.GetFileWithNoData(note);
PXTrace.WriteInformation(file.Name);
}
To download the file, create a DAC field of string type. You can initialize the string to the file name in the FieldDefaulting or FieldSelecting event. Declare an Action and use the LinkCommand attribute in the ASPX file to make that field control a link.
In that Action event handler, you can redirect the browser to the file in order to download/open it:
UploadFileMaintenance uploadFileMaintenance = PXGraph.CreateInstance<UploadFileMaintenance>();
Guid[] notes = PXNoteAttribute.GetFileNotes(cache, dacRecord);
if (notes != null && notes.Length > 0)
{
FileInfo downloadFile = uploadFileMaintenance.GetFile(notes[0]);
if (downloadFile != null)
{
throw new PXRedirectToFileException(downloadFile.UID, true);
}
}