Uploading a file using a CRUD setup

Hey guys, trying to make a crud set up that allows you to upload images and view those images. Using CakePHP 2.10.18 and I’m stumped because I cant find many tutorials on the subject.

In 2019, have you tried to go for CakePHP 3x?

Anyway…

You will have to custom code a bit here.
Show the code of your controller that saves and the one that views.

Thanks for the reply, I figured it out. Thank you. Yes, eventually I will try to jump on version 3x.

I think you can use this code.


<?php
if($imagePath) {
echo $this->Html->image($imagePath, array(‘alt’ => ‘uploaded image’,‘id’=>‘imageimg’));
}
?>



<?php echo $this->Form->input('imageimage', array('type' => 'file','id'=>'imageupload','label'=>' UPLOAD IMAGE')); ?>