What is your problem ? What I can see quickly :

$fileData, what is it ? Maybe i am wrong but seems that $fileData is
"unknown" ...

On Aug 16, 8:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I want to upload a file in the folder 'images' and give him a name
> like this:      id_from_database.jpg and insert the filename in my
> database table 'languages'.
>
> Please help
>
> Stanley
>
> Controller:
>
> function add()
> {
> if (!empty($this->data))
>         {
>             if ($this->Language->save($this->data))
>             {
>                 $this->data['Language']['id'] = $id;
>                 $this->data['Language']['image'] = $fileData;
>
> HOW TO GET the request parameters from my form view?
>                 $this->saveAs($fileData,$id,'img/images');
>                 $this->flash('Saved','/language/language_list');
>             }
>         }
>
> }
>
> function saveAs($fileData, $fileName, $folder)
>         {
>                 if (is_writable($folder)) {
>
>                         if (is_uploaded_file($_FILES[$fileData]['tmp_name']))
>                         {
>                                 copy($_FILES[$fileData]['tmp_name'], 
> $folder.$fileName);
>                                 return true;
>                         }
>                         else
>                         {
>                                 return false;
>                         }
>                 }
>                 else
>                 {
>                         return false;
>                 }
>         }
>
> View:
> <form method="post" action="<?php echo $html->url('/language/add')?>">
>         Name:
>         <br />
>         <?php echo $html->input('Language/jezyk', array('size' =>
> '40'))?>
>         <br />
>
>         Image:
>         <br />
>         <?php echo $html->file('Language/image');   ?>
>
>         <?php echo $html->submit('Save') ?>
> </form>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to