Switch to binary mode once logged-in.
Data transfer in binary mode works for both ASCII and binary (such as JPEG images) files. Therefore it should be the default. Fixes #3
This commit is contained in:
parent
3a7f65cd20
commit
ebf946ada5
12
ftp.go
12
ftp.go
@ -61,7 +61,17 @@ func (c *ServerConn) Login(user, password string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, _, err = c.cmd(StatusLoggedIn, "PASS %s", password)
|
_, _, err = c.cmd(StatusLoggedIn, "PASS %s", password)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Switch to binary mode
|
||||||
|
_, _, err = c.cmd(StatusCommandOK, "TYPE I")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter extended passive mode
|
// Enter extended passive mode
|
||||||
|
Loading…
Reference in New Issue
Block a user