1. Sending and receiving files
1.1 Overview
This chapter examines how to handle file uploads to Rails and file downloads to a user.
Sections in this chapter:
- Getting a file to Rails – Howto build the right form to upload a file to Rails.
- Saving an uploaded file to the filesystem
- The simplest thing that could possibly work – a barebones example of saving an uploaded file.
- Saving the filename and content-type – covers reading the content-type and getting a clean filename.
- Conditional file save – saving the file only when the record is valid.