Creating forms and submitting data is usually easy until you have to deal with file uploads. Luckily, the framework doesn't tread on any toes here and lets you build the process as your application demands.
In this recipe, we'll look at a file upload scenario and build a process that is clean and helps maintain the separation of concerns in our application.
To begin with, we'll need to create a table to track our file uploads. For this, create a table named
uploads with the following SQL statement:
CREATE TABLE uploads ( id INT(11) NOT NULL AUTO_INCREMENT, name VARCHAR(100) NOT NULL, size INT(4) UNSIGNED NOT NULL, mime VARCHAR(50) NOT NULL, path TEXT NOT NULL, created DATETIME, modified DATETIME, PRIMARY KEY(id) );