Any Cakephp 3 Image Uploading tutorial Online?

Hi guys, does anyone have know of a cakephp 3 upload image upload tutorial online?

I have been having problem uploading a file from my cakephp form.

Your help would be appreciated.

I use this:

    public function add()
    {
        $dogs = TableRegistry::get('Dogs');
        $lid = $dogs->find()->where(['dogid >' => 0])->count();
        echo $lid;
        //$this->autoRender = false;
        if (isset($_POST['submit'])) {

            // exit();
            $lid = $lid + 1;
            $target_path = WWW_ROOT . 'img/imgdogs/';
            $file_name = $_FILES['ufile']['name'];
            $parts = explode(".", $file_name);
            $fname = $parts[0];
            $new_file_name = $fname . $lid . "." . "jpg";
            //$path = $new_file_name;
            $to_path = $target_path . $fname . $lid . "." . "jpg"; //set the target path with a new name of image
            //echo $path;

            if ($file_name != '') {

                if (move_uploaded_file($_FILES['ufile']['tmp_name'], $to_path)) {
                    echo "Successful<BR/>";


                    echo "File Name :" . $new_file_name . "<BR/>";
                    echo "File Size :" . $_FILES['ufile']['size'] . "<BR/>";
                    echo "File Type :" . $_FILES['ufile']['type'] . "<BR/>";
                } else {
                    echo "Error";
                }
            }

            $dogpic = Cln::fixValue($new_file_name);
            $dogname = ucfirst(Cln::fixValue($_POST['dogname']));
            $sex = ucfirst($_POST['sex']);
            $comments = Cln::fixValue($_POST['comments']);
            $adopted = (isset($_POST['adopted']) == '1' ? '1' : '0'); ///added
            $lastedit = date("Y-m-d H:i:s");
            echo "adpt=" . $adopted . "aaa";

            if (!isset($error)) {
                $postdata = array(
                    'dogpic' => $dogpic,
                    'dogname' => $dogname,
                    'sex' => $sex,
                    'comments' => $comments,
                    'adopted' => $adopted,
                    'lastedit' => $lastedit
                );

                //$dogs = TableRegistry::get('Dogss');
                $query = $dogs->query();
                $query->insert(['dogpic', 'dogname', 'sex', 'comments', 'adopted', 'lastedit'])
                        ->values($postdata)
                        ->execute();
            }
        }

        $this->viewBuilder()->layout('dogedittpl');
        //$this->set(compact('data2'));
    }

and view

<div style="margin-right:auto;margin-left:0px; width:900px;">


    <form action='' method='post' enctype="multipart/form-data">
        <table style="border:none; width: 700px;">
            <tr>
                <td>dogpic:</td>
                <td>
                <!--<input type="text" name="dogpic" id="dogpic">-->
                    <input name="ufile" type="file" id="ufile" size="50" /></td>
                </td>
            </tr>




            <tr>
                <td>dogname:</td>
                <td>
                    <input type="text" name="dogname" id="dogname">
                </td>
            </tr>




            <tr>
                <td>sex:</td>
                <td>
                    <input type="text" name="sex" id="sex">
                </td>
            </tr>




            <tr>
                <td>comments:</td>
                <td style="width: 200px;">
                    <input type="text" name="comments" id="comments" size="200">
                </td>
            </tr>









            <tr>
                <td>adopted:</td>
                <td><input type="checkbox" name="adopted" id="adopted" value="1" /></td>
            </tr>





        </table>
        <!--<input type="hidden" name="token" value="<?php //echo $token; ?>" />-->
        <p><input type='submit' name='submit' value='Add'></p>
    </form>




</div>

of course view is part of a layout

This works, just not cleaned up yet. Don’t worry about cake, just concetrate on php uploading.

Hello.

I use this one: http://josediazgonzalez.com/2015/12/05/uploading-files-and-images/

Very clean, well structured and easy to handle.

Thanks for your response @ jimgwhit,

thanks Themiller, I really appreciate

I tried to use this plugin, but It kept giving me errors, that plugin could not be loaded.

Please can you help me further?