Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
how to write an binary file to ftp
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Guo Yangguang  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 06:09
From: Guo Yangguang <rails-mailing-l...@andreas-s.net>
Date: Sun, 8 Nov 2009 07:09:52 +0100
Local: Sun 8 Nov 2009 06:09
Subject: how to write an binary file to ftp
Net::FTP#putbinaryfile(binary_file, remotefile)

binary_file is not a local file from some directory,but a dynamic
generation from codes.

The above codes not work,how to write it to ftp?
--
Posted via http://www.ruby-forum.com/.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guo Yangguang  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 06:44
From: Guo Yangguang <rails-mailing-l...@andreas-s.net>
Date: Sun, 8 Nov 2009 07:44:31 +0100
Local: Sun 8 Nov 2009 06:44
Subject: Re: how to write an binary file to ftp

ftp api itself has binary mode ,but not support writing file which
itself is initially binary data?

--
Posted via http://www.ruby-forum.com/.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guo Yangguang  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 09:27
From: Guo Yangguang <rails-mailing-l...@andreas-s.net>
Date: Sun, 8 Nov 2009 10:27:33 +0100
Local: Sun 8 Nov 2009 09:27
Subject: Re: how to write an binary file to ftp
My server does not support filesystem writing,so i can not store the
binary_file data as an image in the file directory,and then send the
image using   Net::FTP#putbinaryfile method.
Could i send the binary_file directly using
Net::FTP#putbinaryfile(binary_file, remotefile)?

--
Posted via http://www.ruby-forum.com/.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frederick Cheung  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 09:54
From: Frederick Cheung <frederick.che...@gmail.com>
Date: Sun, 8 Nov 2009 01:54:39 -0800 (PST)
Local: Sun 8 Nov 2009 09:54
Subject: Re: how to write an binary file to ftp

On Nov 8, 9:27 am, Guo Yangguang <rails-mailing-l...@andreas-s.net>
wrote:

> My server does not support filesystem writing,so i can not store the
> binary_file data as an image in the file directory,and then send the
> image using   Net::FTP#putbinaryfile method.
> Could i send the binary_file directly using
> Net::FTP#putbinaryfile(binary_file, remotefile)?

Looking at the source to net/ftp it doesn't look like putbinaryfile
can do that, however all putbinaryfile seems to do is open up the file
and pass it to storbinary, presumably you could pass any IO object (eg
a StringIO) to storbinary.

Fred


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guo Yangguang  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 14:47
From: Guo Yangguang <rails-mailing-l...@andreas-s.net>
Date: Sun, 8 Nov 2009 15:47:34 +0100
Local: Sun 8 Nov 2009 14:47
Subject: Re: how to write an binary file to ftp
thanks,Fred.
But i get the ftppermerror when using storbinary and StringIO.
########
Net::FTP.open('showreelfinder.com') do |ftp|
      ftp.passive=true
      ftp.login(name,password)
      ftp.chdir('www.showreelfinder.com/web/site/temp/uploads/heywatch
                                                           /thumbnails')

     thumbnail_file=StringIO.new(thumbnail)
     ftp.storbinary("STOR"+"#{thumb_title}",thumbnail_file,1024)

end
###########
The thumbnail is binary file,so can i use the stringio?
can you tell me the details? I can not find an good example in ruby
document.
Thank you very much!

--
Posted via http://www.ruby-forum.com/.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frederick Cheung  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 15:32
From: Frederick Cheung <frederick.che...@gmail.com>
Date: Sun, 8 Nov 2009 07:32:38 -0800 (PST)
Local: Sun 8 Nov 2009 15:32
Subject: Re: how to write an binary file to ftp

On Nov 8, 2:47 pm, Guo Yangguang <rails-mailing-l...@andreas-s.net>
wrote:

> thanks,Fred.
> But i get the ftppermerror when using storbinary and StringIO.

are you sure the specified user can upload files

> ########
> Net::FTP.open('showreelfinder.com') do |ftp|
>       ftp.passive=true
>       ftp.login(name,password)
>       ftp.chdir('www.showreelfinder.com/web/site/temp/uploads/heywatch
>                                                            /thumbnails')

>      thumbnail_file=StringIO.new(thumbnail)
>      ftp.storbinary("STOR"+"#{thumb_title}",thumbnail_file,1024)

Looks like you are missing a space after STOR, you should probably
also make the chdir and absolute path.

Fred


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guo Yangguang  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 15:44
From: Guo Yangguang <rails-mailing-l...@andreas-s.net>
Date: Sun, 8 Nov 2009 16:44:43 +0100
Local: Sun 8 Nov 2009 15:44
Subject: Re: how to write an binary file to ftp

> are you sure the specified user can upload files
> yes,i am sure
>> ########
>> Net::FTP.open('showreelfinder.com') do |ftp|
>> ftp.passive=true
>> ftp.login(name,password)
>> ftp.chdir('www.showreelfinder.com/web/site/temp/uploads/heywatch
>> /thumbnails')

>> thumbnail_file=StringIO.new(thumbnail)
>> ftp.storbinary("STOR"+"#{thumb_title}",thumbnail_file,1024)

> Looks like you are missing a space after STOR,

   thank,i will try.
you should probably
> also make the chdir and absolute path.

  I am sure the following path is right
--
Posted via http://www.ruby-forum.com/.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guo Yangguang  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 15:48
From: Guo Yangguang <rails-mailing-l...@andreas-s.net>
Date: Sun, 8 Nov 2009 16:48:09 +0100
Local: Sun 8 Nov 2009 15:48
Subject: Re: how to write an binary file to ftp

thumbnail_file=StringIO.new(thumbnail)

do i need to change the above like this?Because i think the thumbnail is
binary file.

thumbnail_file=StringIO.new(thumbnail.to_s)
--
Posted via http://www.ruby-forum.com/.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frederick Cheung  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 15:53
From: Frederick Cheung <frederick.che...@gmail.com>
Date: Sun, 8 Nov 2009 07:53:39 -0800 (PST)
Local: Sun 8 Nov 2009 15:53
Subject: Re: how to write an binary file to ftp

On Nov 8, 3:48 pm, Guo Yangguang <rails-mailing-l...@andreas-s.net>
wrote:

> thumbnail_file=StringIO.new(thumbnail)

> do i need to change the above like this?Because i think the thumbnail is
> binary file.

If you've got a string ruby doesn't care about what's in it (of course
exactly what that line should depends on what kind of object you
have). You wouldn't get a permission error if you got that wrong
though - you'd probably just upload junk

Fred


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guo Yangguang  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 16:07
From: Guo Yangguang <rails-mailing-l...@andreas-s.net>
Date: Sun, 8 Nov 2009 17:07:51 +0100
Local: Sun 8 Nov 2009 16:07
Subject: Re: how to write an binary file to ftp

> If you've got a string ruby doesn't care about what's in it (of course
> exactly what that line should depends on what kind of object you
> have). You wouldn't get a permission error if you got that wrong
> though - you'd probably just upload junk

hi fred

  After add a blank character and change thumbnail to thumbnail.to_s,my
project works now.Thank you very much.

--
Posted via http://www.ruby-forum.com/.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google