Uploading an ActionDispatch::Http::UploadedFile to Google Storage

Hello everyone I am trying to get an image upload system working on my
site. I am at the final stage of the most painful programming experience
of my life any help would be greatly appreciated.

in my model I have

before_save :store_meta
after_save :store_file

#@profile_picture is passed in the controller from params from a
file_field

def store_file
trgs = TRGoogleStorage::obtain_client
trgs.add_file_to_bucket( ‘band_mates_avatars’,
self.avatar_google_name, @profile_picture )
end

I have tested trgs.add_file_to_bucket with files from my hard drive and
it works. I don’t want to write a file to my hard drive though I just
want to feed it to google storage.

TRGoogleStorage::obtain_client simply makes a client from the gem GStore
and has a bunch of wrapper functions in-case I change to S3 or
something.

Thank you everyone.

So der der der browsers create a tmp file on the server automatically
any way so trying to do the data feed was useless.

ActionDispatch::Http::UploadedFile has a wonderful function called path
so it was nothing more than

def store_file
trgs = TRGoogleStorage::obtain_client
file_path = @profile_picture.path
trgs.add_file_to_bucket( ‘band_mates_avatars’,
self.avatar_google_name, file_path )
end