Question

I have a app for iOS and I have the user pick a image with a UIImagePickerController. How can I upload that image to my rails app using dragonfly. I think I would use multipart-image-data but I don't know how I would do this.

Was it helpful?

Solution

Easiest way to do it would be to hand off the "bag of bits" (data of the image) to AFNetworking to upload it your rails application.

EDIT To answer your question about how to handle the upload, you could do something like this. Remember to set the name used in AFNetworking is the same as the params key

def uploadFile
    post = DataFile.save(params[:upload])
    render :text => "File has been uploaded successfully"
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top