This is totally possible, but you do have to read the entire file into a ruby string object before sending, or make a multi-RPC-call scheme on your own. There aren't any transports that will help you with this - those are all for Thrift's communication, not for reading in large binaries.
On Mon, Jul 18, 2011 at 5:30 AM, Srinivasan Anand <[email protected]>wrote: > Hi, > > I am a newbie with Apache Thrift. Though I was able to setup a simple > Server/Client message exchange with the help of Thrift in Ruby > (ruby-thrift-0.6.0), I am actually facing some difficulties in setting up > the code for a simple file upload/transfer functionality from the Client to > the Server. > > Since there is no File data type accepted by thrift, I actually had read > the > file contents with the File.open("file_path",'rb'){|f| f.read} as string > and > transported over to the server and then writing to a new file copy. This > worked for txt files. But in the case of PDF, DOC and probably all other > file types, this doesn't work out. I also tried using the base64 encoding > and decoding mechanisms for this, but no luck. > > Following some of the posts in the users-mailing list archives, I thought > the TFileTransport or TSimpleFileTransport or TFDTransport should do the > magic. But I am not able to find either of them in the ruby-thrift gem > apart > from the Buffered, Framed, HTTPClient, IOStream and MemoryBuffer > Transports. > Am I correct in understanding that these TFileTransport or > TSimpleFileTransport or TFDTransport acually help in transfer/upload of the > files in Java/C++ ? or Am I seriously missing something? > > Can we actually do a kind of File Upload (not big file, max 10Mb) with the > ruby-thrift gem from the client to the server. If not, can you suggest any > other possible alternatives for doing this? > > Some links I had referred to in the archives: > > http://mail-archives.apache.org/mod_mbox/thrift-user/201010.mbox/%[email protected]%3E > > > Anand >
