On 9/26/07, Scott Sharkey <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I'm working on a form to upload a file, and the traditional way to do
> that involves the FileHandler model, and a beforeValidate() function in
> the model which validates the file type, size, etc and moves the file
> from tmp storage to where-ever.  This is working just fine.
>
> Except that now I want to name the file with the userID of the person
> who uploaded it...  I would have thought that would have been in
> $this->data['model']['userid'] in the beforeValidate() function.
> However, when I try to access this, it tells me that there is no
> index named 'model' in the data array...  It appears that $this->data is
> empty, near as I can tell.
>
> Am I missing something, or is this supposed to be that way.  IF it
> matters, this model uses the validate array for some of the other fields.
>

Well, are you populating your form with the user ID?  How else will
CakePHP know what the uploader's user ID is?

The file upload stuff I've used in a recent project did all the work
in an afterSave() method, not the beforeValidate() but YMMV.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation
http://www.cakedevelopment.com

My motto for 2007:  "Just build it, damnit!"

@TheKeyboard - http://www.littlehart.net/atthekeyboard

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