Bruce,
I have a NT 6.27 app containing two files, XLog and XCRF. XCRF is related to XLog via a sys_id field. I display a browse of the XCRF file on a tab. Here I want to simply insert a record that stores a chosen PDF in a blob field.
XCRF contains sys_id, date, file_description and file_contents (blob) fields. Upon insert I choose the file upload button and navigate out to my local drive for a PDF document. Upon returning I want the file_description field to fill with the name of the file. Upon saving, the pdf file should be saved to the blob. I have this working by placing the following code in the validate embed of the file upload field:
If glo:CRF_Filename <> ''
XCRF:CRF_FileName = Clip(glo:CRF_Filename) !!CRF_Filename is the description
ImageEx:FileToBLOB(Clip(glo:CRF_Filename), CRF:CRF_File) !!CRF:CRF_File is the blob in XCRF
End
glo:CRF_Filename is set to Clip(self.site.WebFolderPath)&'\'&ReturnValue in the HandleFile embed of the WebHandler procedure.
This seems to work well with Inserts. For example, I insert abc.pdf and xyz.pdf and both appear in the browse and the pdf contents are in the blob. However, when I click change to view an entry, the description field (CRF_Filename) always fills with the description of the last record added, in this case xyz.pdf. Is there a better way to accomplish this? That is a better embed I should use? I have tried many others such as Validate All, Validate Insert, Pre and Post Insert, etc. I have also looked at examples 26 and 40, and other postings here for hints.
Thanks,
Jeff King