b logica,
have taken your advise and renamed the field as you wisely suggested.
I'm still perplexed as to why this saves the files, but with nothing
in the $student_id:

        function add($student = null) {

        if (!empty($this->data) &&
             is_uploaded_file($this->data['Myfile']['File']
['tmp_name'])) {
            $fileData = fread(fopen($this->data['Myfile']['File']
['tmp_name'], "r"),
                                     $this->data['Myfile']['File']
['size']);

            $this->data['Myfile']['name'] = $this->data['Myfile']
['File']['name'];
            $this->data['Myfile']['type'] = $this->data['Myfile']
['File']['type'];
            $this->data['Myfile']['size'] = $this->data['Myfile']
['File']['size'];
            $this->data['Myfile']['data'] = $fileData;
            $this->data['Myfile']['student_id'] = $student;

            $this->Myfile->save($this->data);

            $this->flash('The file has been uploaded.','/students/
main');
        }
    }

and this works fine (but obviously not practical)??

        function add($student = null) {

        if (!empty($this->data) &&
             is_uploaded_file($this->data['Myfile']['File']
['tmp_name'])) {
            $fileData = fread(fopen($this->data['Myfile']['File']
['tmp_name'], "r"),
                                     $this->data['Myfile']['File']
['size']);

            $this->data['Myfile']['name'] = $this->data['Myfile']
['File']['name'];
            $this->data['Myfile']['type'] = $this->data['Myfile']
['File']['type'];
            $this->data['Myfile']['size'] = $this->data['Myfile']
['File']['size'];
            $this->data['Myfile']['data'] = $fileData;
            $this->data['Myfile']['student_id'] = 5114;

            $this->Myfile->save($this->data);

            $this->flash('The file has been uploaded.','/students/
main');
        }
    }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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