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)?
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.
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')
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!
> 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!
> 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')
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
> 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.