thanks again b logica.

Have tried what you have suggested with no luck.  What I am passing is
just an integer.  I am passing this integer to the function so I know
which student the file is for.  I just had a thought that it might be
easier to just pass the variable in the controller rather than in the
form since it is already there, and isn't input by the user...
something like this:

        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'] = $student;

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

            $this->flash('The file has been uploaded.', "/myfiles/view/
${student}", 2);
        }
    }

The file saves to the database, but nothing is saved under the
'student' field..... also the 'flash' doesn't work correctly, and just
redirects to '/myfiles/view/'.
--~--~---------~--~----~------------~-------~--~----~
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