From the course: Hands-On Introduction: Ruby on Rails

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Adding camera support

Adding camera support

- [Instructor] Our application wouldn't be so useful if it's only limited to uploading images we already have. In this video, we'll add support to upload a photo from your smartphone camera. For this, we'll use an HTML property. Open the form partial, look for the file field and add a couple of parameters. The first one is accept image/*. The second one is to capture environment. Save the changes and let's test it. Start the server, now switch to the browser, click on new post, and if you click choose file, you'll see that the file selector still appears. It'll work like this from a computer, but you'll see the change if you open this page from your smartphone. But first, you need to use the URL you're using in the computer. I'm going back to the list in the browser to show you the URL. Now, open the browser on your smartphone. Type .URL and then add /posts. Now I'm with my smartphone creating a new post. I click on select image and the camera appears. I take a picture of my printer…

Contents