SendFile

Definition

Usage

Send files to the device, usually to the /mnt/mtdblock/ directory. For TFT devices, if user pictures or advertisement pictures are sent, the files should be named in the following formats and automatically moved to corresponding directories. Naming of advertisement pictures: prefix "ad" +a numeral ranging from 1 to 20 + suffix ".jpg", for example, ad_4.jpg Naming of user pictures: user ID + ".jpg", for example, 1.jpg

Parameter

Device number

Name of the file to be sent

Return Value

Return True if it is successful, or return False.

Related Function

ReadFile

 

Ejemplo

C#

//Create Standalone SDK class dynamicly.
zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
private void SendFile(string sIp = "10.0.0.44", int iPort = 4370, int iMachineNumber = 1
    , string sFileName = "C:\\name.jpg"
    )
{
    axCZKEM1.Connect_Net(sIp, iPort);

    int idwErrorCode = 0;

    if (axCZKEM1.SendFile(iMachineNumber, sFileName))
    {
        axCZKEM1.RefreshData(iMachineNumber);//the data in the device should be refreshed
        MessageBox.Show("SendFile " + sFileName + " To the Device! ", "Success");
    }
    else
    {
        axCZKEM1.GetLastError(ref idwErrorCode);
        MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
    }
}

VB

'Create Standalone SDK class dynamicly.
Dim axCZKEM1 As New zkemkeeper.CZKEM
Private Sub SendFile(Optional ByVal sIp As String = "10.0.0.44", Optional ByVal iPort As Integer = 4370,
                        Optional ByVal iMachineNumber As Integer = 1,
                        Optional ByVal sFileName As String = "c:\\Filename.jpg"
    )
    axCZKEM1.Connect_Net(sIp, iPort)
    Dim idwErrorCode As Integer

    If axCZKEM1.SendFile(iMachineNumber, sFileName) = True Then
        axCZKEM1.RefreshData(iMachineNumber) 'the data in the device should be refreshed
        MsgBox("SendFile " + sFileName + " To the Device! ", MsgBoxStyle.Information, "Success")
    Else
        axCZKEM1.GetLastError(idwErrorCode)
        MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
    End If
End Sub