Skip to content

Commit 8332b3b

Browse files
committed
docs: add routing for Upload sample code
1 parent c5db8e6 commit 8332b3b

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

user_guide_src/source/libraries/uploaded_files.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ this code and save it to your **app/Controllers/** directory:
8181
only :ref:`rules-for-file-uploads` can be used to validate upload file with :doc:`validation`.
8282
The rule ``required`` also can't be used, so use ``uploaded`` instead.
8383

84+
The Routes
85+
==========
86+
87+
Using a text editor, open **app/Config/Routes.php**. In it, add the following two routes:
88+
89+
.. literalinclude:: uploaded_files/021.php
90+
8491
The Upload Directory
8592
====================
8693

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
// ...
4+
5+
/*
6+
* --------------------------------------------------------------------
7+
* Route Definitions
8+
* --------------------------------------------------------------------
9+
*/
10+
11+
// We get a performance increase by specifying the default
12+
// route since we don't have to scan directories.
13+
$routes->get('/', 'Home::index');
14+
15+
$routes->get('upload', 'Upload::index'); // Add this line.
16+
$routes->post('upload/upload', 'Upload::upload'); // Add this line.
17+
18+
// ...

0 commit comments

Comments
 (0)