Hi Chris, Yes, the userid is on the form (hidden). Problem is that the ENTIRE data array appears empty... no fields at all.
AfterSave won't work for me - I need to reject the file if it's wrong type, wrong size, et al. Maybe I could try beforeSave though? Not sure if I can invalidate it there if need be? -Scott Chris Hartjes wrote: > 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. > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
