O'Reilly logo

Learning Joomla! 1.5 Extension Development by Joseph L. LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling file uploads

Although most needs for data storage can be handled through the database, sometimes you will want to allow users to upload files to the server. Joomla! provides a library that makes it easy to safely handle file uploads.

For the Restaurant Reviews component, we want to make it possible for the critics to upload MP3 files to go with the reviews. To handle this, we need to adjust the form on which reviews are entered so that it accepts files. Also, the save() function in our controller for the backend needs to be adjusted to look for the file and copy it to the correct place.

First, open the file /administrator/components/com_restaurants/views/single/tmpl/default.php and make the following highlighted adjustments:

<form action="index.php" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required