문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top