fiogf49gjkf0d Well the quick answer is no easy way....but the answer is yes as I just did this for a client. You need to do an FSO copy from the selected by the user document file location to the SLXAttachmentPath area and then store an Attachment record.....I suppose you could store the AttachID into your table which would give you the 1 item reference link? here's what I did.....note I'm only using !+12 character AttachID for the Filename in the SLX attachment doc directory. I used the Attachment Support included script for many/most/all of the routines and hints....
<pre>
' das Globals
Dim strFile, strFileName, strExt, strFileDate, intFileSize Dim FSO, oFile ' specific file information.
''' ***** File Selection lookup edit control: Sub lueFilePopupReturn(Sender)
lueUserID.Text = currentUserID
' FSO stuff.... strFile = lueFile.Text Set FSO = CreateObject("Scripting.FileSystemObject") 'DNL strExt = FSO.GetExtensionName(strFile) strFileName = FSO.GetFileName(strFile)
Set oFile = FSO.GetFile(strFile) intFileSize = oFile.Size strFileDate = oFile.DateLastModified set oFile = Nothing
Set FSO = Nothing
txtDocumentType.Text = strExt
' set screen controls ' file size numFileSize.Text = intFileSize '' sets the databound field. lblFileSize.Caption = FormatFileSize( intFileSize ) '' sets the display caption. ' attachment description in english txtFileDesc.Text = StripExtensionFromFile( strFileName ) ' who is attaching lblAttachedBy.Caption = "Attached by: " & currentUserName
' file date lblAttachModified.Caption = strFileDate dteAttachDate.DateTime = strFileDate
' file name txtFileName.Text = trim("!" & currentAttachID & "." & strExt) End Sub
' ******* on the OK button that stores the Attachment record automagically: gBlnHostDB = (Trim(GetField("DBTYPE", "SYSTEMINFO", "SYSTEMINFOID = 'PRIMARY'")) = 1) 'DNL gStrAttachPath = Application.BasicFunctions.GetAttachmentPath gStrSiteCode = GetSiteCode()
if isAddMode then ' process the file strFile = lueFile.Text Set FSO = CreateObject("Scripting.FileSystemObject") 'DNL strfileName = trim("!" & currentAttachID & "." & strExt) ' copy form Source to Target. Full path + file name is required. Application.Debug.WriteLine "Source: " & strFile & " Target: " & gStrAttachPath & strfilename
fso.CopyFile strFile , gStrAttachPath & strfilename Set FSO = Nothing else strFile = gStrAttachPath & txtFileName.Text end if
If NOT(gBlnHostDB ) Then '''remote attachment record Dim aCN Set aCN = NEW SLX_DB 'ADO Connection Object Dim SQL SQL ="INSERT INTO REMOTEATTACHMENTS (ATTACHID, STATUS, SITECODE) VALUES (" & _ " '" & currentAttachID & "', " & _ " 'SEND', " & _ " '" & gStrSiteCode & "' ) "
aCN.ExecuteSQL SQL SET aCN = Nothing End If
</pre> |