Ok Gang:
I’ve been searching, and reading, and searching to find information on uploading a file that would meet my need. And nothing seems to fit. Can any one help?
Requirements:
-
Create and update actions may or may not have a file uploaded.
-
When a file is uploaded, I need to rename the saved file as well as save that name in the ‘file_name’ column.
-
I also want to save the the size and mimeType into the ‘file_size’ and ‘file_type’ columns respectively.
-
If the $model->save() works, THEN move/save the file.
-
If, during update the file is being changed, I need to overwrite/delete the old file and save the new one with the old filename.
-
MVC seems to dictate that this should be down in the beforeSave()/afterSave() functions in the model, but all of the code examples use the controller.
I am just so confused that I don’t know where to look anymore.
Any help would be greatly appreciated. JK