O'Reilly logo

Zend Framework 2.0 by Example Beginner's Guide by Krishna Shasankar V

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

Time for action – creating a file upload form

In this task, we will be creating a new document upload form; file uploads will be stored in the filesystem, and the information regarding the file upload will be stored in the database in a table named uploads. The file uploads are stored in a folder location defined in the module configuration. Perform the following steps to do so:

  1. Our first step will be to define a location where files can be uploaded in the module's configuration (config/module.config.php):
    <?php
    return array(
      // Other configurations
      // ..
      // ..
      // MODULE CONFIGURATIONS
      'module_config' => array(
        'upload_location' => __DIR__ . '/../data/uploads',
      ),
    );
  2. Next, we need to create a table which will store the upload information:
    CREATE TABLE ...

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