« Return to Thread: Multiple picture uploads

Multiple picture uploads

by michel-45 :: Rate this Message:

Reply to Author | View in Thread

Hi everyone,

I am trying to upload more than one picture file from a web page. I am  
using the example code given on the 4D site:

If (BLOB size(picBLOB)>0)  ` did user select a file for uploading?
        C_STRING(255;$fileHeader)
        $offset:=0  ` BLOB to text requires a variable for the offset parameter
        $fileHeader:=BLOB to text(picBLOB;Text without length ;$offset;255)
        $fileNameBegin:=Position("filename=";$fileHeader)+10
        For ($i;$fileNameBegin;255)
                If ($fileHeader≤$i≥=Char(Double quote ))
                        $fileNameEnd:=$i
                        $i:=255
                End if
        End for
        $fileName:=Substring($fileHeader;$fileNameBegin;$fileNameEnd-
$fileNameBegin)
        $contentTypeBegin:=Position("Content-Type:";$fileHeader)+14
        For ($i;$contentTypeBegin;255)
                If ($fileHeader≤$i≥=Char(Carriage return ))
                        $contentTypeEnd:=$i
                        $i:=255
                End if
        End for
        contentType:=Substring($fileHeader;$contentTypeBegin;$contentTypeEnd-
$contentTypeBegin)
        DELETE FROM BLOB(picBLOB;0;$contentTypeEnd+3)
        $err:=AP Read picture BLOB (picBLOB;imageVar)
End if

This works fine for uploading one picture but seems to not work on  
multiple pictures. I have identical code right after this code but  
substituted picBLOB with picBLOB1. Using TRACE the picBLOB variable  
gives the picture size but picBLOB1 variable always seems to display  
the picture file name.

Anyone know how to get around this?

Thanks,
Michel.
**********************************************************************
4D Basics hosted by 4D, Inc.                       http://www.4D.com/

Power, Speed, Scalability is 4D v11 SQL
Upgrade today! <http://store.4ddepot.com/>

To Unsubscribe:                        mailto:4DBasics-off@...
**********************************************************************


 « Return to Thread: Multiple picture uploads