Hi All,
NT 8.19
CL 9.0
Postgres
Trying to get multiple file uploads to work and having a problem creating duplicates
On a form called from a browse I have the +Add File button. This was working properly (I think)
When the user click the button and select a file(s) the code is supposed to create a detailed record linked to the header record by sysid.
The uploaded file is also stored in a blob in the detail record.
This works fine if the user selects just one file.
If the user selects multiple files to upload I get duplicate files uploaded.
When I look at the physical files that have been uploaded to the server they are fine, all present and correct.
Part of my problem is I don't really understand what is happening when multiple files are uploaded?
See code below to do this.
VoiceDtls ROUTINE
CLEAR(cvfd:Record)
FileName = p_web.GetValue('CVF:vfuplnames')
cvfd:cvfsysid = p_web.GetSessionValue('CVF:cvfsysid')
cvfd:cussysid = p_web.GetSessionValue('CVF:cussysid')
cvfd:UserName = p_web.GetSessionValue('UserName')
cvfd:UploadName = vuExtractFileName(FileName)
cvfd:FileType = UPPER(SUB(CLIP(FileName),-3,3))
cvfd:FileSize = vuFileSize(FileName)
Dti:FileType = Clip(cvfd:FileType)
IF Dti:FileType = 'PDF'
cvfd:LengthMins = 1
ELSE
IF access:dictime.Fetch(Dti:sk_tfiletype) = Level:Benign
FileLength = cvfd:FileSize/Dti:minsperbyte
cvfd:LengthMins = FileLength
ELSE
cvfd:FileSize = 0
cvfd:LengthMins = 0
END
END
cvfd:ProcessedDate = 0
cvfd:MasterDoc = 'N'
cvfd:WhoUploaded = p_web.GetSessionValue('UserName')
cvfd:UploadDate = Today()
cvfd:FileProcessed = 'N'
cvfd:UploadTime = Clock()
cvfd:UploadBy = p_web.GetSessionValue('StaffID')
cvfd:dcovf = 'DOCUMENT'
Access:CustVFDtl.Insert() = Level:Benign
IF EXISTS(FileName)
cvfd:CustVFBlob{PROP:Size}=0
IF FILETOBLOB(FileSpec, cvfd:CustVFBlob) !returns an ERRORCODE if copy fails
MESSAGE(CLIP(FileSpec) & ' BLOB was not copied - ERRORCODE: ' & ERRORCODE())
ELSE
IF Access:CustVFDtl.Update() = Level:Benign
!REMOVE(CVF:vfuplnames)
END
END
END
EXIT
Called from
code
! Start of "Save File"
! [Priority 5000]
! End of "Save File"
p_web.SetSessionValue('_save_CVF:vfuplnames',CVF:vfuplnames)
p_web.SaveFile('CVF:vfuplnames',CVF:vfuplnames)
! Start of "Save File"
! [Priority 5000]
DO VoiceDtls
! End of "Save File"