$fileData this is the first parameter of my function : saveAs($fileData, $fileName, $folder) .
I want to use this function in "add" action by pass in this function three parameters: ( "'imageFile', $imgId, WWW_ROOT . 'folder/subfolder/' ) Where 'imageFile' is the name of the file field. I want to use function from this website: http://cakeforge.org/snippet/detail.php?type=snippet&id=7 I hope you understand me. Simply i'm looking for short scripts to upload a file and i found the one above. Stan On Aug 16, 8:43 pm, francky06l <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
