Sample code for 30+ languages & platforms
Visual FoxPro

Extract Files from MIME

See more MIME Examples

Extract files from a MIME message.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loMime
LOCAL loSt
LOCAL n
LOCAL i

lnSuccess = 0

* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loMime = CreateObject('Chilkat.Mime')

* Load a MIME document from a file:
* (.mht and .eml files contain MIME).
lnSuccess = loMime.LoadMimeFile("mst.mht")
IF (lnSuccess = 0) THEN
    ? loMime.LastErrorText
    RELEASE loMime
    CANCEL
ENDIF

loSt = CreateObject('Chilkat.StringTable')
lnSuccess = loMime.PartsToFiles("/temp/mimeParts",loSt)
IF (lnSuccess = 0) THEN
    ? loMime.LastErrorText
    RELEASE loMime
    RELEASE loSt
    CANCEL
ENDIF

n = loSt.Count

* Display the paths of the files created:
i = 0
DO WHILE i < n
    ? loSt.StringAt(i)
    i = i + 1
ENDDO

RELEASE loMime
RELEASE loSt