milesj/cake-uploader — Issue #45: Uploading/saving/SQL issues in 3.4
Author: Nitrev
Created: 2012-03-08 19:58:33+00:00
State: open

Miles,

First of all, thanks for the SaveAll functionality in 3.4. I really appreciate the fast updates. I've been working around with it today, and it works most of the time, but there is some issues with saving/uploading

First off, when the form uses just one model, and the file upload field is part of the same model (i.e., MyModel.fileName), the behavior works without any errors.

When the form uses several models, the hasMany relationships (MySecondModel.0.fileName, MySecondModel.1.fileName etc) also works perfectly when uploading several files at once.

However, I'm running into a problem.

When a form uses several models, and the field is part of the main model (i.e., MyModel.fileName) , when saving, the Attachment behavior doesn't seem to activate. Cake just returns an SQL error as it's trying to insert an array into the DB text field.

What I've tried so far:

-I've double checked the code, and I can see (with debug) that the behavior is is properly set on the model, and all the config settings are correct.

-Tried a save() instead of a saveAll() on the model, but it gives the same error.

So, in short, consider the following form:
MyModel.fileName
MySecondModel.0.fileName
MySecondModel.1.fileName

When saving this form, the first input field doesn't activate the behavior, while the second 2 work perfectly.

Any ideas?