SocketError (getaddrinfo: Name or service not known)

I want write image(thumbnail is binary data) to
ftp://showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/heywatch
directory. But i got error like following:

remove ftp:// from you ftp_host variable

daociyiyou wrote:

ftp.putbinaryfile(thumbnail,"ftp://showreelfinder.com/
www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title)

change to

ftp.putbinaryfile(thumbnail,"/www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title)

tom

daociyiyou wrote:

back, your code is wrong

  ftp = Net::FTP.new(ftp_host)
  ftp.login('username','password')
  ftp.chdir('/www.showreelfinder.com/web/site/temp/uploads/heywatch/')
  ftp.putbinaryfile(thumbnail, encoded_video.title)
  ftp.close

tom

daociyiyou wrote:

I have changed to ftp.putbinaryfile(thumbnail,"/www.showreelfinder.com/
web/site/temp/uploads/heywatch/"+encoded_video.title) and still got
that error. Then i changed to

ftp.putbinaryfile(thumbnail,"/www.showreelfinder.com/web/site/temp/
uploads/heywatch/"+encoded_video.title+".jpg")

The same error happend.

Thanks.
I have changed the wrong codes but got the third error:

so you have to check the directory manually

I suppose change chdir to web/site/temp/uploads/heywatch ...

tom

daociyiyou wrote:

try to set passive mode

daociyiyou wrote:

Thank you very much! After changed to passive mode,it works for normal
image file.But for thumbnail(binary data),i does not.The ftp api does
not support binary data writing? I got the error:No such file or
directory

"I got the error:No such file or directory"

it's not problem with binary mode, but with your file :slight_smile:

tom

daociyiyou wrote:

ftp api itself has binary mode ,but not support the file writing
which itself is initially binary data?
not support binary data writing? I got the error:No such file or
directory