php - Cakephp SQL Error 1054 Unknown Column In The Field List uploading image file -
I'm totally confused with this I am trying to upload an image but I continue this error I have searched the site and I have searched many single questions but I did not get any of these solutions to work for me. Public function process image upload ($ check = array ()) {if (! Is_uploaded_file ($ [[image]] ['tmp_name'] check) {return incorrect;} if (! Move_uploaded_file ($ Check ['image'] ['tmp_name'], WWW_ROOT. 'IMG' DS 'upload' .desche [[image]] ['name'])) {return false;} $ this- & gt; ; Data [$ this-> nickname] ['image'] = 'upload' DS $ check ['image'] ['name']; return TRUE;}
Next time I add my code to PostsController
(if ($ this->;; - ('Post')) {$ This- & gt; Request-> Data ['Post'] ['Use User name ('username'); $ this- & gt; after & gt; create ($); $ data = $ this- & gt; request- ($ Data ['post']; if ($$ [[image]] ['name']) {unset ($ data ['image']);} if ($ this-> post- & Gt; Save ($ data)) {$ the-> Session-> Set Flash (__ ('Your Post Has Saved')); $$ -> (- 'Action' => Index ');); } $ This- & gt; Session-> Set Flash (__ ('Unable to add your post.')); }}
Then I have my form where the file has been uploaded.
copy $$ -> form-> Created ('Post' array ('type' = & gt; 'file')); Echo $ the-> Form- & gt; Input ('title'); Copy $ this- & gt; Form- & gt; Input ('movie'); Echo $ the-> Form- & gt; Input ('category'); Echo $ the-> Form- & gt; Input ('Description', array ('rows' => 2')); Copy $ the-> gt; Form- & gt; Input ('image', array ('type' = & gt; 'file')); Echo $ the-> Form- & gt; End ('submit paragraph for review');
Why does the array in the function string in my model not change?
Because it was not considered.
What the function is doing is uploading your file to the server and setting the database value as its code PATH
, does not convert to a binary file in its database is being done.
Comments
Post a Comment