How to download images to files from database using PeopleCode
The code below will download images to files.
Local File &FILE;
Local Record &REC;
Local SQL &SQL;
&REC = CreateRecord(Record.EMPL_PHOTO);
&SQL = CreateSQL("%SelectAll(:1)", Record.EMPL_PHOTO);
&FILE = GetFile("C:\temp\EMPL_PHOTO.GIF", "w", "a", %FilePath_Absolute);
While &SQL1.Fetch(&REC)
&FILE.WriteRaw(&REC.EMPLOYEE_PHOTO.Value);
End-While;
&FILE.Close();
Help me a lot
ReplyDeleteHelp me a lot
ReplyDeleteThanks a lot. Really Helpful.
ReplyDeletecan i use this logic to download .pdf file?
ReplyDelete