I’ve table called Uploads.
I’ve to make entries in this tables twice with ‘type’
i.e. for youtube video link and image in table uploads
So I’ve written code like this
//for video link
echo $form->input(‘Project.Upload.Name’, array(‘type’=>’file’,’label’ => false));
and
//for image
echo $form->input(‘Project.Upload.Name’, array(‘type’=>’file’,’label’ => false));
How can I differentiate these two fields?
Is there any way so of naming convention so that I can separate out fields for links and images.
If you want two Upload-fields, you have to name them like this:
This will create an array in
$this->dataready for use. Have a look on how to save related model data in the Cookbook for more and deeper information.Edit
If you need to keep track of what type your upload is you have to add it like this:
What you do here is that you associate your first upload with the first type-field which has the hidden value ‘image’. So the first entry would be stored in your database something like this (as Cake-Array):
The processing of the image and the video must of course be done before saving it so the database.