Upload by josegonzalez , i does not upload the file..

2012-11-07 Thread fernando menendez
I installed the Plugin, i do not see any error it is saving to the 
Database, but not save the Dir fro the file. and DO not upload the file, 
here is my Code :
my Model :

class Picture extends AppModel {

public function beforeValidate() {
$this-data['Picture']['filename']['name'] = 
strtolower($this-data['Picture']['filename']['name']);
return true;
}

public $actsAs = array(
'Upload.Upload' = array(
'filename' = array(
'fields' = array(
'dir' = 'dir',
'type' = 'mimetype',
'size' = 'filesize',
),
   'thumbnailSizes' = array(
'xvga' = '1024x768',
'vga' = '640x480',
'thumb' = '80x80'
),
'pathMethod' = 'flat',
'path' = '{ROOT}webroot{DS}dvdpictures{DS}'
)
)
);

public $validate = array(
'filename' = array(
'rule' = 'isSuccessfulWrite',
'message' = 'File was unsuccessfully written to the server'
)
);

THE CONTROLLER :
public function add($Subject = null, $idEvento = null) {
if ($this-request-is('post')) {
$this-Picture-create();
$this-request-data['Picture']['filename'] = 
AuthComponent::user('id') . '_' . $idEvento . '_' . 
$this-request-data['Picture']['filename']['name'];
$this-request-data['Picture']['event_id'] = $idEvento;
$this-request-data['Picture']['created'] = getdate();
if ($this-Picture-save($this-request-data)) {
$this-redirect(array('action' = 'index', $Subject, 
$idEvento));
} else {
$this-Session-setFlash(__('The Picture could not be 
saved. Please, try again.'));
}
}
}

What am i missing ??

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




I do not get an Error but only a The connection was reset

2012-11-01 Thread fernando menendez
Hi

I have this line of code in my XXXController.php :

$this-request-data['Picture']['filename'] = $this-data['User']['ID'] + 
'_' + $idEvento + '_' + $this-request-data['Picture']['filename'] + ;

I spent like 1 day trying to figure out, why when i run that Controller 
method just gave me an ugly browser error The connection was reset
so, i opened my ayes better and find out that my line of code had an extra 
+ , damn , i just removew that extra + and it worked fine.
My Question is Why i did not got an error from the compiler/interpreter to 
tell me something wrong in that line?


Thanks in advance

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.