FUNCTION GENTOFILE *--Extracts a .BMP,.DOC,.GIF, or .JPG file embedded in a .DBF General field *--via the APPEND GENERAL command, which adds header and trailer which *--must be stripped off during extraction PARAMETERS lcFieldname,lcFilename LOCAL lcCompatible,lcExtension,liTopOffset,liEndOffset,; lcTempfile,liHandelin,liHandleout,liSize,llSuccess lcCompatible=SET("COMPATIBLE") && Store "Compatible" Setting SET COMPATIBLE ON lcExtension=UPPER(RIGHT(TRIM(lcFilename),3)) DO CASE CASE lcExtension="BMP" liTopOffset=599 liEndOffset=83 CASE lcExtension="DOC" liTopOffset=610 liEndOffset=2654 CASE lcExtension="GIF" liTopOffset=663 liEndOffset=3780 CASE lcExtension="JPG" liTopOffset=648 liEndOffset=3779 ENDCASE lcTempfile=SYS(3) && Assign temporary file name COPY TO (lcTempfile) FIELDS (lcFieldname) NEXT 1&& Copy General field data to it liHandlein=FOPEN(lcTempfile+".FPT") && Open its .FPT liSize=FSIZE(lcTempfile+".FPT")-(liTopoffset+liEndOffset) && Determine data size =FSEEK(liHandlein,liTopoffset) && Move pointer past Top Offset liHandleout=FCREATE(lcFilename) && Create output file =FWRITE(liHandleout,FREAD(liHandlein,liSize)) && Copy data to it =FCLOSE(liHandlein) && Close the temporary .FPT.. =FCLOSE(liHandleout) && ...and the output file lcTempfile=lcTempfile+".*" && Erase temporary .DBF/.FPT ERASE (m.lcTempfile) SET COMPATIBLE &lcCompatible && Reset "Compatible" IF FILE(lcFilename) llSuccess=.T. ENDIF RETURN llSuccessThere's a similar program on the Fox Wiki: