-
-
Save gregorynicholas/68e345aa2a56859b8cf4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## RubyMotion | |
imageData = UIImage.UIImageJPEGRepresentation(@image_view.image, 1) | |
encodedData = [imageData].pack("m0") | |
data["image"] = encodedData | |
BW::HTTP.post("http://localhost:3000/upload}", {payload: data}) do |response| | |
if response.ok? | |
end | |
end | |
## Rails backend | |
if params["image"] | |
unpack = params["image"].unpack("m0") | |
File.open("/tmp/image.jpg", "w+b") do |f| | |
f.write(unpack.first) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment