Skip to content

Commit

Permalink
Merge pull request #6260 from kenjis/fix-docs-uploaded_files.rst
Browse files Browse the repository at this point in the history
docs: fix uploaded_files.rst
  • Loading branch information
kenjis authored Jul 13, 2022
2 parents eb83ec8 + 8332b3b commit 537e896
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
13 changes: 10 additions & 3 deletions user_guide_src/source/libraries/uploaded_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ find reference information.
Creating the Upload Form
========================

Using a text editor, create a form called upload_form.php. In it, place
Using a text editor, create a form called **upload_form.php**. In it, place
this code and save it to your **app/Views/** directory:

.. literalinclude:: uploaded_files/001.php
Expand All @@ -46,7 +46,7 @@ wrong.
The Success Page
================

Using a text editor, create a form called upload_success.php. In it,
Using a text editor, create a form called **upload_success.php**. In it,
place this code and save it to your **app/Views/** directory::

<!DOCTYPE html>
Expand All @@ -72,7 +72,7 @@ place this code and save it to your **app/Views/** directory::
The Controller
==============

Using a text editor, create a controller called Upload.php. In it, place
Using a text editor, create a controller called **Upload.php**. In it, place
this code and save it to your **app/Controllers/** directory:

.. literalinclude:: uploaded_files/002.php
Expand All @@ -81,6 +81,13 @@ this code and save it to your **app/Controllers/** directory:
only :ref:`rules-for-file-uploads` can be used to validate upload file with :doc:`validation`.
The rule ``required`` also can't be used, so use ``uploaded`` instead.

The Routes
==========

Using a text editor, open **app/Config/Routes.php**. In it, add the following two routes:

.. literalinclude:: uploaded_files/021.php

The Upload Directory
====================

Expand Down
18 changes: 18 additions & 0 deletions user_guide_src/source/libraries/uploaded_files/021.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

// ...

/*
* --------------------------------------------------------------------
* Route Definitions
* --------------------------------------------------------------------
*/

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'Home::index');

$routes->get('upload', 'Upload::index'); // Add this line.
$routes->post('upload/upload', 'Upload::upload'); // Add this line.

// ...

0 comments on commit 537e896

Please sign in to comment.