No error returned for upload but no file for SFTP

func (c *Client) Upload(local, remote string) error {
    client, err := sftp.NewClient(c.SSHClient)
    if err != nil {
        return err
    }
    defer client.Close()

    localFile, err := os.Open(local)
    if err != nil {
        return err
    }
    defer localFile.Close()

    remoteFile, err := client.Create(remote)
    if err != nil {
        return err
    }

    _, err = io.Copy(remoteFile, localFile)
    return err
}

I call this function to upload a file to SFTP, and no error is returned.

upload using the command line as follows:

I use the above function to upload:

var localFilePath = "./1234.zip"
var remoteDir = "upload/uuuuu.zip"
err = client.Upload(localFilePath, remoteDir)
if err != nil {
    panic(err)
}
fmt.Println("")

No errors are returned in the execution result, only
This service allows sftp connections only.

is returned.

but log in to SFTP, there are no uploaded files, please give us some advice!

Mar.11,2021

has the subject solved the same question

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39f70-2c1ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39f70-2c1ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?