2009年9月2日星期三

[fw-mvc] Change name of file transfer

Hi All,
I have a problem when I want to change the name of all the images. When I upload them with Zend_File_Transfer_Adapter_Http I get an error.
Here is the code and the error:

The code
foreach ($files as $file => $info) {
                if($upload->isValid($file)){
                    $files['picture']['name'][$count] = $files[$file]['name'];
                    $count ++;
                    $upload->addFilter('Rename', ROOT_DIR.ROOT_IMAGE_UPLOAD, rand().'.jpg');
                    if ($upload->receive($file)){
                        print_r($upload->getMessages());
                    }
                }
            }

The error
Warning: array_search() [function.array-search]: Wrong datatype for second argument in.../Zend/File/Transfer/Adapter/Http.php on line 164

Thank's.

没有评论: