Hi,
Myself vishal facing a problem while uploading the
image.Actually the image path stored in the database.I want to dispaly
that uploaded image on front.
This is my code :
add.ctp file
<h1>Add User</h1>
<?php
echo $form->create('User', array('action' => '');
echo $form->input('name');
echo $form->input('address', array('rows' => '3'));
echo $form->input('phone');
echo $form->input('mobile');
echo $form->input('email');
echo $form->input('city');
echo $form->input('state');
echo $form->input('image',array('type' => 'file'));
echo $form->end('Save User');
?>
This stored the image path in the image field of database.
But where this image stored in the folder & in which directory.So
please help me as soon as possible.
I also want to make thumb of the image while uploading. send me the
complete code of image uploading & how I show the images on
frontend.????????
This is my controller page:
<?php
class UsersController extends AppController {
var $name = 'Users';
var $layout='user';
//var $layout='edit';
var $paginate = array(
'limit' => 4,
'order' => array(
'User.name' => 'asc'
)
);
function index() {
//$this->set('users', $this->User->find('all'));
$data = $this->paginate('User');
$this->set(compact('data'));
}
function view($id) {
$this->User->id = $id;
$this->set('user', $this->User->read());
}
function delete($id) {
$this->User->del($id);
$this->flash('The user with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}
function add() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->flash('Your detail has been
saved.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}
}
}
function edit($id = null) {
$this->User->id = $id;
if (empty($this->data)) {
$this->data = $this->User->read();
} else {
if ($this->User->save($this->data['User'])) {
$this->flash('Your detail has been
updated.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
}
}
}
}
?>
Please tell me where i am wrong & in which folder images go. so that i
will display on front with its thumb.
Vishal
thanks in advance !!!!!!!!!!!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---