"upload files with CakePHP"
On Dec 27, 8:59 am, mona <poojapinj...@gmail.com> wrote:
> Hello mike
> sorry for distutbing you once again. I am sending you my file
> uploading problem please i need your help if you help me it will be
> great help for me
> this is my add view code please consider it
> <h2>New Entry</h2>
> <?php echo $form->create('Entry',array('action' => 'add','type' =>
> 'file'));?>
> <div class="optional">
> <?php echo $form->input('Section', array('options' => array
> ('Announcements','The Venue','About Melbourne')),array('error' =>
> 'false','value' => array(1,2,3) )); ?>
> </div>
> <div class="optional">
> <?php echo $form->input('Submenu', array('options' => array
> (1,2,3,4,5)),array('error' => false,'label' => 'Submenu')); ?>
> </div>
> <div class="optional">
> <?php echo $form->input('Listitem',array('label' => 'Listitem'),array
> ('error' => false));?>
> </div>
> <div class="optional">
> <?php echo $form->input('Detail',array('label' => 'Detail'),array
> ('error' => false));?>
> </div>
> <div class="optional">
> <?php echo $form->file('File'); ?>
> </div>
> <div class="submit">
> <?php echo $form->submit('Add');?>
> </div>
> </form>
> <ul class="actions">
> <li><?php echo $html->link('Home', '/entries/index')?></li>
> </ul>
>
> from this form i wan't to upload file when I click on submit button
> where to write file upload code please correct my code
> this is my controller code
> <?php
> class EntriesController extends AppController {
>
> var $name = 'Entries';
> var $helpers = array('Html','Form');
>
> function index()
> {
>
> $this->Entry->recursive = 1;
> $this->set('entries', $this->Entry->findAll());
>
> }
> function view($id = null)
> {
> if (!$id)
> {
> $this->Session->setFlash('Invalid id for Entry.');
> $this->redirect('/entries/index');
> }
> $this->set('entry', $this->Entry->read(null, $id));
>
> }
>
> function add()
> {
> if (empty($this->data))
> {
> $this->render();
> }
> else
> {
> //$this->cleanUpFields();
>
> if ($this->Entry->save($this->data))
> {
>
> $this->Session->setFlash('The Entry has been saved');
> $this->redirect('/entries/index');
> }
> else
> {
> $this->Session->setFlash('Please correct errors below.');
> }
> }
> }
> function edit($id = null)
> {
> if (empty($this->data))
> {
> if (!$id)
> {
> $this->Session->setFlash('Invalid id for Entry');
> $this->redirect('/entries/index');
> }
> $this->data = $this->Entry->read(null, $id);
> } else
> {
> //$this->cleanUpFields();
> if ($this->Entry->save($this->data))
> {
> $this->Session->setFlash('The Entry has been saved');
> $this->redirect('/entries/index');
> }
> else
> {
> $this->Session->setFlash('Please correct errors below.');
> }
> }
> }
> function delete($id = null) {
> if (!$id) {
> $this->Session->setFlash('Invalid id for Entry');
> $this->redirect('/entries/index');
> }
> if ($this->Entry->del($id)) {
> $this->Session->setFlash('Record deleted successfully');
> $this->redirect('/entries/index');
> }
> }
>
> }
>
> ?>
> how to upload files from this code
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment