I have an ipad app that uses dropbox to sync images to the cloud so that i can access them with a webapp and process them etc etc.
the part i’m having trouble with is getting the file from dropbox to s3 via carrierwave. i have a photo model and i can create a new photo and upload and an image successfully. I can also put a file on dropbox. However when i try to get a file off of dropbox and put it on s3, the contents of the file is just text.
Are there some sort of mime types i need to set or something?
I am using dropbox_sdk and the get_file_and_metadata method. It returns me the file object successfully, but the contents are all just text. this is me hard coding the image file so i can be sure it exists..
dbsession = DropboxSession.deserialize(session[:dropbox_session])
@client = DropboxClient.new(dbsession, ACCESS_TYPE) #raise an exception if session not authorized
@info = @client.account_info # look up account information
@photo = Photo.new(params[:photo])
@db_image metadata = @client.get_file_and_metadata('/IMG_1575.jpg')
the part i don’t know how to do is say take this image @db_image and use that file when creating a new photo and store it on S3.
I’m thinking it might be a ‘mime type’ issue, but i’ve read that that is only based on the file ext.
any insight you guys could share would really help me get past this hurdle. thanks!
Figured this out. Instead I used the
direct_url.urlmethod that is part of thedropbox-apigem used with thecarrierwavegem. thedirect_url.urlmethod returns a secure full url path to that file that you can use as theremote_urlvalue for carrierwave.Now, i’m pretty new at ruby, so i’ll be posting a better way to step through the results, as that seems pretty slow and clunky.