Saturday, November 19, 2011

how getting upload file array only element.array_file to table.db

hi, the situation is following
the add.ctp will save one file of type ".doc"
all right with description and code type..etc according cakephp`s
manual 2.0

but when get to save..it said me that fiel [doc] of table ordenes cant
be "array", en then i make debug in the controller


(
[Orden] => Array
(
[n_orden] => 11111
[n_admin] => 22222
[cliente] => dadad
[obs_orden] => dadada
[obs_estado] => adada
[estado] => cerrado
[user_id] => 1
[fecha_entrega] => Array
(
[month] => 11
[day] => 19
[year] => 2011
)

[doc] => Array
(
[name] => 5_gsm_web.pdf
[type] => application/pdf
[tmp_name] => /tmp/php0QWesp
[error] => 0
[size] => 700784
)

)

)

**** how i do it.. the controller only take the "[name]" of array
"doc", because "[name]" will be save into fiel of table


i place also this code for checking according documentation

function isUploadedFile($params){
$val = array_shift($params);
if ((isset($val['error']) && $val['error'] == 0) ||
(!empty( $val['tmp_name']) && $val['tmp_name'] != 'none')
) {
return is_uploaded_file($val['tmp_name']);
}
return false;
}

***** how i do the "check flash" for is to be " .doc" and not other
type file???

thanks

regards

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate