php - Using MeioUpload with CakePHP 1.3 -


I'm trying to upload a few simple images using CakePHP 1.3, but I can not do it for life I get to do this work when I have a $ this-> in my controller. Trying to save the data , it tries to save a regular file array instead of just the file name (due to the lack of a better word).

What I'm doing here:

I have put meio_upload.php in / app / model / behavior

In my model, I do the following I am: ARAR ('dir' = & gt; upload IMG {DS} {DS} dispute ',' array ('.png', '.PNG'), 'zoomcrap' = False, 'Angus' = & gt; Array (' Array ('width' = 150; 'height' => 150)), 'Default' = & gt; 'default.png', 'Length' = & gt; array ('minWidth' => 100, 'minhite' => 100, 'maxWidth' => 150, 'maxHeight' => 150))));

In my opinion, I've found the following form:

   Form- & gt; Input ('name', array ('label' = & gt; 'name', 'max length' => gt; '45')); Now this $ -> gt; Form- & gt; Input ('comment', array ('label' = & gt; 'description', 'rows' => 3')); Now this $ -> gt; Form- & gt; Input ('Author', Array ('label' = & gt; 'your name)', 'maximum length' = & gt; '45')); Now $ $-> Form- & gt; Input ('email', array ('label' = & gt; 'email (will not be shown)', 'maximum length' = & gt; '45')); = 'Gtc:' ',' type '= & gt; File ',' label '= & gt;' First AT & gt; Form- & gt; Input ('filename', array ('' between '='> & lt; br / & gt; image (maximum 2MB, 150x150 pixels, .png) '); Counterpart $ this- & gt; Form- & gt; End ('send'); ? & Gt; And finally, I look like adding action to the respective controller:   add function () {if (empty! ($ -> - >)) {$ This-> Controversy- & gt; Create (); If ($ this->> Dispute-> Save ($ -> -> Data)) {$ this- & gt; Session-> Set Flash ('The Controversist Has Saved', True); $ This- & gt; Redirect (array ('action' = & gt; 'index')); } And {$ this- & gt; Session-> Set Flash ('The dispute could not be saved, please try again.', True); Debug ($ this-> data); Debug ($ this-> validationErrors); Die (); // $ this- & gt; Redirect ('add' ('action' = & gt;) 'add'); For future generations, here is my table design:  
  Set delimiter $$ table `Controversies` (` id` integer (11) no zero, `name 'varchar (45) No Tap, `date` not timestamp, tap default CURRENT_TIMESTAMP update at CURRENT_TIMESTAMP,` comment` text, `email` Varchar (45) No 'author' varchar (45) No file name` Varchar (100), primary key (`ID`),) Engine = MySQL Default Charge = UTF 8 $ $   

When I try to submit my form So, this output is array ([name] => Viking [comment] = & gt; Herp: this is:

  app / controller / browler_controller.php (line 37) array ([Controversist] = & gt; A Description. [Author] = & gt; me [email] => me@gmail.com [filename] = & gt; Array ([name] => 5 .png [type] => image / png [tmp_name] = & Gt; / storage / configuration / upload_tamp_dir / pff 2 okd [error] => [[size] => 15863)) AP / Controller / BROSR_SPPPP (line 37)   

Obviously, when it fails The F is never saved in the upload directory tries to save the array specify Ailen field image never seems to actually use the behavior of Meioplod is. How can I verify this?

You have to debate the code I have posted on a large scale, but I think it is better that I tell you what I can do. If someone can get an error, then I will spare many hours of pulling my hair.

I have it

answer for ur query < P> is that you call it an ether variable

$ d1 and copy- $ D1 ['debating'] ['name'] = $ this- & gt; Data ['debater'] ['name'];

all ur variables

$ d1 ['debaters'] [['filename'] = $ this- & gt; Data ['debaters'] ['filename'] ['name'];

And then it's this $ & amp; - & gt; Save ($ d1);

Comments