Click or drag to resize
RunUploadFile Method
Uploads the file into field.

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static int UploadFile(
	string p_FileFullName,
	string p_TableUserName,
	string p_FileLinkName,
	int p_RecordId
)

Parameters

p_FileFullName
Type: SystemString
Full file name to be uploaded.
p_TableUserName
Type: SystemString
Table user name to insert into.
p_FileLinkName
Type: SystemString
Name of the filelink field to use to attache the file.
p_RecordId
Type: SystemInt32
The record id to use to attach the uplaoded file.

Return Value

Type: Int32
Error code.
Examples
This is an example of use of UploadFile to Uploads the file into field.
Example VB.Net
Imports System
Imports System.Collections
Imports Biolomics.BioCallback
Imports Biolomics.SharedClasses
Imports Biolomics.Utility.DatabaseConstants


Public Class Program

    <STAThread()>
    Shared Sub Main()
        Dim program As New Program
        program.UploadFile()
        program.CheckRecords()
    End Sub

    Public Sub UploadFile()
        '    *****    Get selected record IDs    *****
        Dim RecordIdList As New Generic.List(Of Integer)
        Dim ErrorCode As Integer = Run.GetSelRecordIdList(RecordIdList, Run.GetRecordIdListEnum.Selected)
        If RecordIdList.Count = 0 Then
            Return
        End If

        '    get the current connection
        Dim SqlCo As XConnection = Run.GetCurrentConnection()
        If SqlCo Is Nothing Then
            Return
        End If

        '    get the current layout table 
        Dim CurrentLayout As XDataLayout = Run.GetCurrentLayout()
        If CurrentLayout Is Nothing Then
            Return
        End If

        '    get the current table displayed in that layout
        Dim TableDef As XTableDef = SqlCo.GetTableDef(CurrentLayout.TableKey)
        If TableDef Is Nothing Then
            Return
        End If

        Dim FullFileName As String = "Your_Full_Fil_Name\result.png"
        Dim FileLinkName As String = "Your_FileLink_Field_Name"

        '    attach to the first selected record
        Dim RecordId As Integer = RecordIdList(0)
        ErrorCode = Run.UploadFile(FullFileName, TableDef.UserName, FileLinkName, RecordId)
        If ErrorCode <> 0 Then
            Console.Write(vbCrLf & "Could not upload file")
        End If

    End Sub


End Class
See Also