I am writing an addon where user can upload stuff with descriptions, titles, and various options.
i got quite far, but i ran into the problem of cleaning postvars in an array. (when for example uploading a bunch of images.
In the controllerPublic Action domyupload i get following if I do a print_r($_POST)
Now cleaning cat_id and qg_upload_policy is easy..
I do:
But then I have to clean [image] and that is a multiple array.
(55 and 54 are the image ids)
My first approach would be to do:
$images = $this->_input->filterSingle('image', XenForo_Input::ARRAY_SIMPLE);
then I would do a foreach loop
foreach($images as $image)
{
}
but then I'm stuck.. and I have the feeling that this is quite complicated eating up lots of ressources for a simple thing..
Help would be appreciated
Luc
i got quite far, but i ran into the problem of cleaning postvars in an array. (when for example uploading a bunch of images.
In the controllerPublic Action domyupload i get following if I do a print_r($_POST)
PHP:
Array
(
[cat_id] => 21
[qg_upload_policy] => 1
[image] => Array
(
[55] => Array
(
[title] => Real Title 1
[desc] => Description for image 1
[title_temp] => My default title 1
[uploaded] => 1
)
[54] => Array
(
[title] => Real Title 2
[desc] => Description for image 2
[title_temp] => My default title 1
[uploaded] => 1
)
)
[attachment_hash] => 0d65289a23796a06fa665dcbecd965a8
[_xfToken] => 1,1289944902,17544bc009aa2a89a1958ee03ebdd51dd18f26da
)
Now cleaning cat_id and qg_upload_policy is easy..
I do:
PHP:
$catId = $this->_input->filterSingle('cat_id', XenForo_Input::UINT);
$uploadPolicy = $this->_input->filterSingle('qg_upload_policy', XenForo_Input::UINT);
(55 and 54 are the image ids)
My first approach would be to do:
$images = $this->_input->filterSingle('image', XenForo_Input::ARRAY_SIMPLE);
then I would do a foreach loop
foreach($images as $image)
{
}
but then I'm stuck.. and I have the feeling that this is quite complicated eating up lots of ressources for a simple thing..
Help would be appreciated
Luc