Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small fish ftp can't upload image ! #7

Open
myalexer opened this issue Apr 8, 2015 · 0 comments
Open

small fish ftp can't upload image ! #7

myalexer opened this issue Apr 8, 2015 · 0 comments

Comments

@myalexer
Copy link

myalexer commented Apr 8, 2015

i can't upload image into ftp
func Uper(w http.ResponseWriter , r _http.Request) {
ftp := new(ftp.FTP)
// debug default false
ftp.Debug = true
ftp.Connect(_ftp, 21)
// login
ftp.Login(*us, *ps)
if ftp.Code == 530 {
fmt.Println("error: login failure")
}

// pwd
ftp.Pwd()
fmt.Println("code:", ftp.Code, ", message:", ftp.Message)                   

// make dir
ftp.Request("TYPE I")

// stor file
bs := ioutil.ReadFile("./img_temp/myimage.png")

ftp.Stor("/images/myimage.png", bs)

ftp.Quit()      

}

result on command line :
<cmd>
<code> 220
<message> FTP Server ready.
<cmd> USER [myusername_secret]
<code> 331
<message> Password required for [myuser_secret]
<cmd> PASS [mypassword_secret]
<code> 230
<message> User [myuser_secret] logged in.
<cmd> PWD
<code> 257
<message> "/" is the current directory
code: 257 , message: "/" is the current directory
<cmd> TYPE I
<code> 200
<message> Type set to I
<cmd> PASV
<code> 227
<message> Entering Passive Mode (79,127,127,81,166,78).

i can't see error in this result !
all things ok !
upload success but image is bad !
image size before upload : 398724 byte And after upload : 0 byte !!!
why? how solved this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant