clemos wrote:
> hi jon and all
>
> what is on line 219 of your
> /myserver/app/controllers/businesses_controller.php ?
>
> for file upload, I actually use this component which does perfectly the job :
> http://cakeforge.org/snippet/detail.php?type=snippet&id=36
> I've written my own File model, FilesController and stuff around it,
> all of which are quite simple (the files table has only
> "id","name","location","mime","extension")...
>
> and I populate the db by manipulating the $this->params['data'] array
> after doing the FileHandler stuff, and before saving the model
> for you it would be probably somethin like :
> $this->params['data']['Business']['imageFile'] =
> $_FILES[filename][name]; // or in my case :
> $this->fileHandler->filename
> $this->Business->save($this->params['data']);
> (I don't know if it's the "good" way, but it works quite well to me)
> (my File::add() function is in the bottom of this msg)
>
> anyway it seems to me more a CakePHP MVC issue than a problem of file
> upload itself (you could get this error trying to populate your db
> with any "off the conventions" stuff)
> could you please tell us more about your businesses table, your
> Business model and you businessesController ?
>
> ++++++++
> clemos
>
>  = = = = =
>
> function add(){
>               if(empty($this->params['data'])){
>
>
>
>               }else{
>                                               
> if($this->FileHandler->upload("upload","app/webroot/files/",null,true)){
>
>
>
>                               $this->params['data']['Fichier']['location'] = 
> $this->webroot .
> substr($this->FileHandler->location,12); //don't remember why it's
> substr 12...
>                               $this->params['data']['Fichier']['filename'] = 
> $this->FileHandler->filename;
>                               $this->params['data']['Fichier']['mime'] =
> $this->FileHandler->type; // added this property to FileHandler
> component myself
>                               $this->params['data']['Fichier']['extension'] =
> strtolower($this->FileHandler->ext); // and this one too
>
>
>                                       
> $this->Fichier->set($this->params['data']);
>                                       $this->Fichier->save();
>                                       $this->flash('fichier 
> enregistré','/fichiers/');
>
>
>                       }else{
>                               $this->flash('erreur 
> #'.$this->FileHandler->error.' de
> téléchargement du fichier ','/fichiers/');
>                       }
>
>               }
>
>
>       }
>
>  = = = =
>
> On 6/25/06, linkingarts <[EMAIL PROTECTED]> wrote:
> >
> > jb-
> >
> > thanks for the input but that isn't exactly the issue. What I don't
> > quite get is a) why I'm getting an "index" error, and b) how to
> > populate the db (with the imageFile [name] value in addition to the
> > other values passed by the form) at the same time I'm uploading the
> > file into a specific directory.
> >
> > BTW enctype is not the issue, it is in the form tag correctly (I
> > mentioned that in the original post).
> >
> > Just still trying to get the hang of Cake overall; I'm getting most
> > things to work here and there but it seems like every new thing I want
> > to do takes 6 hrs to figure out. Then it's like, "oohhhhh, sh---..."
> >
> >
> > >
> >


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

Reply via email to