Have you declared var $actsAs = array('Upload' =>
array(__OPTIONS_HERE__) ); in the model?
Have you put the UploadBehaviour in app/models/behaviours/
upload.php ?
Please paste your model.
On Oct 19, 7:08 am, Indian Baker <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm referring to the following excellent link to try and do a file
> upload,http://groups.google.com/group/cake-php/browse_thread/thread/be474455...
>
> Now the problem is, if I do t a regular Form post in my view like
>
> <?php echo $form->create('Resumedetail',array('action'=>'MyAdd')); ?>
>
> It adds the records and the file name to the database, but doesnt
> actually upload the file. ( 777 permissions have been set to the
> folder)
>
> But If I try to do this
> <?php echo $form-
>
> >create('Resumedetail',array('type'=>'file','action'=>'MyAdd')); ?>
>
> It throws up the following error:
> Query: INSERT INTO `resumedetails`
> (`resume_id`,`resume_content`,`pic`,`resume_file`) VALUES
> (2,'ooo',Array,Array)
> Its try to pass Array where I've defined the input box as "file"
>
> Here is the code I'm using
>
> -------------------- View --------------------------------
> <div class="resumedetail">
> <?php echo
> $form->create('Resumedetail',array('type'=>'file','action'=>'MyAdd')); ?>
>
> <fieldset>
> <legend><?php __('Add');?> <?php
> __('Resumedetail');?></legend>
> <?php
> echo $form->input('resume_id');
> echo $form->input('resume_content');
> echo $form->input('pic',array('type'=>'file'));
> echo $form->input('resume_file',array('type'=>'file'));
> ?>
> </fieldset>
> <?php echo $form->end('Submit');?>
> </div>
>
> ------------------------------- Controller
> ---------------------------------------
> function MyAdd() {
> if (!empty($this->data)) {
> $this->cleanUpFields();
> $this->Resumedetail->create();
> if ($this->Resumedetail->save($this->data)) {
> $this->Session->setFlash('The Resumedetail
> has been saved');
> $this->redirect(array('action'=>'index'),
> null, true);
> } else {
> $this->Session->setFlash('The Resumedetail
> could not be saved.
> Please, try again.');
> }
> }
> $resumes = $this->Resumedetail->Resume->generateList();
> $this->set(compact('resumes'));
> }
>
> Any help will be greatly appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---